Bounding Box/find rez from inventory point code now seems to be working correctly.

So next step is to clean up that code and wait for bug reports.
trunk
MW 2009-07-15 19:46:32 +00:00
parent 856d5f4375
commit a266e6dc4b
2 changed files with 24 additions and 6 deletions

View File

@ -2312,14 +2312,19 @@ namespace OpenSim.Region.Framework.Scenes
AddNewSceneObject(group, true); AddNewSceneObject(group, true);
// m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z);
// if attachment we set it's asset id so object updates can reflect that // if attachment we set it's asset id so object updates can reflect that
// if not, we set it's position in world. // if not, we set it's position in world.
if (!attachment) if (!attachment)
{ {
float offsetHeight = 0;
pos = GetNewRezLocation( pos = GetNewRezLocation(
RayStart, RayEnd, RayTargetID, Quaternion.Identity, RayStart, RayEnd, RayTargetID, Quaternion.Identity,
BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(), false); BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false);
pos.Z += offsetHeight;
group.AbsolutePosition = pos; group.AbsolutePosition = pos;
// m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight);
} }
else else
{ {

View File

@ -592,9 +592,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Gets a vector representing the size of the bounding box containing all the prims in the group /// Gets a vector representing the size of the bounding box containing all the prims in the group
/// Treats all prims as rectangular, so no shape (cut etc) is taken into account /// Treats all prims as rectangular, so no shape (cut etc) is taken into account
/// offsetHeight is the offset in the Z axis from the centre of the bounding box to the centre of the root prim
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public Vector3 GetAxisAlignedBoundingBox() public Vector3 GetAxisAlignedBoundingBox(out float offsetHeight)
{ {
float maxX = -256f, maxY = -256f, maxZ = -256f, minX = 256f, minY = 256f, minZ = 256f; float maxX = -256f, maxY = -256f, maxZ = -256f, minX = 256f, minY = 256f, minZ = 256f;
lock (m_parts) lock (m_parts)
@ -659,7 +660,6 @@ namespace OpenSim.Region.Framework.Scenes
backBottomRight.Y = orig.Y + (part.Scale.Y / 2); backBottomRight.Y = orig.Y + (part.Scale.Y / 2);
backBottomRight.Z = orig.Z - (part.Scale.Z / 2); backBottomRight.Z = orig.Z - (part.Scale.Z / 2);
frontTopLeft = frontTopLeft * worldRot; frontTopLeft = frontTopLeft * worldRot;
frontTopRight = frontTopRight * worldRot; frontTopRight = frontTopRight * worldRot;
frontBottomLeft = frontBottomLeft * worldRot; frontBottomLeft = frontBottomLeft * worldRot;
@ -795,10 +795,23 @@ namespace OpenSim.Region.Framework.Scenes
} }
Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ);
offsetHeight = 0;
float lower = (minZ * -1);
if (lower > maxZ)
{
offsetHeight = lower - (boundingBox.Z / 2);
}
else if (maxZ > lower)
{
offsetHeight = maxZ - (boundingBox.Z / 2);
offsetHeight *= -1;
}
// m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z);
return boundingBox; return boundingBox;
} }
#endregion #endregion
public void SaveScriptedState(XmlTextWriter writer) public void SaveScriptedState(XmlTextWriter writer)