From a7043ebf53fc469af79877dfb1cde4c3588c969e Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 13 Jul 2009 12:08:14 +0000 Subject: Attempt to make it so items rezzed from inventory aren't half in the ground or half in the prim they are being rezzed on top off. This is currently only correct for single prims (not link groups) and unrotated prims. Next step is to fix for link sets and rotated prims. This needs a lot more testing to find use cases where it might be wrong (like half way up a hill?) --- OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs index d8c7b84..63a93aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs @@ -303,7 +303,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) { // rez ON the ground, not IN the ground - pos.Z += 0.25F; + // pos.Z += 0.25F; obj = m_scene.AddNewPrim(avatar.UUID, group_id, pos, rotation, pbs); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 92cea43..ac2d02e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1349,8 +1349,11 @@ namespace OpenSim.Region.Framework.Scenes Vector3 offset = (normal * (ScaleOffset / 2f)); pos = (intersectionpoint + offset); + //Seems to make no sense to do this as this call is used for rezzing from inventory as well, and with inventory items their size is not always 0.5f + //And in cases when we weren't rezzing from inventory we were re-adding the 0.25 straight after calling this method // Un-offset the prim (it gets offset later by the consumer method) - pos.Z -= 0.25F; + //pos.Z -= 0.25F; + } return pos; @@ -1380,6 +1383,11 @@ namespace OpenSim.Region.Framework.Scenes { // fall back to our stupid functionality pos = RayEnd; + + //increase height so its above the ground. + //should be getting the normal of the ground at the rez point and using that? + float ScaleOffset = Math.Abs(scale.Z); + pos.Z += ScaleOffset / 2f; return pos; } } @@ -1393,7 +1401,7 @@ namespace OpenSim.Region.Framework.Scenes if (Permissions.CanRezObject(1, ownerID, pos)) { // rez ON the ground, not IN the ground - pos.Z += 0.25F; + // pos.Z += 0.25F; The rez point should now be correct so that its not in the ground AddNewPrim(ownerID, groupID, pos, rot, shape); } -- cgit v1.1