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?)
trunk
MW 2009-07-13 12:08:14 +00:00
parent e5e6f4c6df
commit a7043ebf53
2 changed files with 11 additions and 3 deletions

View File

@ -303,7 +303,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos)) if (m_scene.Permissions.CanRezObject(1, avatar.UUID, pos))
{ {
// rez ON the ground, not IN the ground // 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); obj = m_scene.AddNewPrim(avatar.UUID, group_id, pos, rotation, pbs);
} }

View File

@ -1349,8 +1349,11 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 offset = (normal * (ScaleOffset / 2f)); Vector3 offset = (normal * (ScaleOffset / 2f));
pos = (intersectionpoint + offset); 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) // Un-offset the prim (it gets offset later by the consumer method)
pos.Z -= 0.25F; //pos.Z -= 0.25F;
} }
return pos; return pos;
@ -1380,6 +1383,11 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// fall back to our stupid functionality // fall back to our stupid functionality
pos = RayEnd; 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; return pos;
} }
} }
@ -1393,7 +1401,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Permissions.CanRezObject(1, ownerID, pos)) if (Permissions.CanRezObject(1, ownerID, pos))
{ {
// rez ON the ground, not IN the ground // 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); AddNewPrim(ownerID, groupID, pos, rot, shape);
} }