diff options
author | MW | 2009-07-15 19:46:32 +0000 |
---|---|---|
committer | MW | 2009-07-15 19:46:32 +0000 |
commit | a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5 (patch) | |
tree | 727ae3a6f6e6520dae55bbb31621aa18b3b18686 | |
parent | Yet more work on fixing the boundingbox code. (diff) | |
download | opensim-SC-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.zip opensim-SC-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.tar.gz opensim-SC-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.tar.bz2 opensim-SC-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 23 |
2 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3a5107d..c277bdd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2312,14 +2312,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2312 | 2312 | ||
2313 | AddNewSceneObject(group, true); | 2313 | AddNewSceneObject(group, true); |
2314 | 2314 | ||
2315 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | ||
2315 | // if attachment we set it's asset id so object updates can reflect that | 2316 | // if attachment we set it's asset id so object updates can reflect that |
2316 | // if not, we set it's position in world. | 2317 | // if not, we set it's position in world. |
2317 | if (!attachment) | 2318 | if (!attachment) |
2318 | { | 2319 | { |
2320 | float offsetHeight = 0; | ||
2319 | pos = GetNewRezLocation( | 2321 | pos = GetNewRezLocation( |
2320 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 2322 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
2321 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(), false); | 2323 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); |
2324 | pos.Z += offsetHeight; | ||
2322 | group.AbsolutePosition = pos; | 2325 | group.AbsolutePosition = pos; |
2326 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
2327 | |||
2323 | } | 2328 | } |
2324 | else | 2329 | else |
2325 | { | 2330 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d0de5f2..e987445 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -587,21 +587,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
587 | return returnresult; | 587 | return returnresult; |
588 | } | 588 | } |
589 | 589 | ||
590 | 590 | ||
591 | 591 | ||
592 | /// <summary> | 592 | /// <summary> |
593 | /// Gets a vector representing the size of the bounding box containing all the prims in the group | 593 | /// Gets a vector representing the size of the bounding box containing all the prims in the group |
594 | /// Treats all prims as rectangular, so no shape (cut etc) is taken into account | 594 | /// Treats all prims as rectangular, so no shape (cut etc) is taken into account |
595 | /// offsetHeight is the offset in the Z axis from the centre of the bounding box to the centre of the root prim | ||
595 | /// </summary> | 596 | /// </summary> |
596 | /// <returns></returns> | 597 | /// <returns></returns> |
597 | public Vector3 GetAxisAlignedBoundingBox() | 598 | public Vector3 GetAxisAlignedBoundingBox(out float offsetHeight) |
598 | { | 599 | { |
599 | float maxX = -256f, maxY = -256f, maxZ = -256f, minX = 256f, minY = 256f, minZ = 256f; | 600 | float maxX = -256f, maxY = -256f, maxZ = -256f, minX = 256f, minY = 256f, minZ = 256f; |
600 | lock (m_parts) | 601 | lock (m_parts) |
601 | { | 602 | { |
602 | foreach (SceneObjectPart part in m_parts.Values) | 603 | foreach (SceneObjectPart part in m_parts.Values) |
603 | { | 604 | { |
604 | 605 | ||
605 | Vector3 worldPos = part.GetWorldPosition(); | 606 | Vector3 worldPos = part.GetWorldPosition(); |
606 | Vector3 offset = worldPos - AbsolutePosition; | 607 | Vector3 offset = worldPos - AbsolutePosition; |
607 | Quaternion worldRot; | 608 | Quaternion worldRot; |
@@ -659,7 +660,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
659 | backBottomRight.Y = orig.Y + (part.Scale.Y / 2); | 660 | backBottomRight.Y = orig.Y + (part.Scale.Y / 2); |
660 | backBottomRight.Z = orig.Z - (part.Scale.Z / 2); | 661 | backBottomRight.Z = orig.Z - (part.Scale.Z / 2); |
661 | 662 | ||
662 | |||
663 | frontTopLeft = frontTopLeft * worldRot; | 663 | frontTopLeft = frontTopLeft * worldRot; |
664 | frontTopRight = frontTopRight * worldRot; | 664 | frontTopRight = frontTopRight * worldRot; |
665 | frontBottomLeft = frontBottomLeft * worldRot; | 665 | frontBottomLeft = frontBottomLeft * worldRot; |
@@ -795,10 +795,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
795 | } | 795 | } |
796 | 796 | ||
797 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); | 797 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); |
798 | |||
799 | offsetHeight = 0; | ||
800 | float lower = (minZ * -1); | ||
801 | if (lower > maxZ) | ||
802 | { | ||
803 | offsetHeight = lower - (boundingBox.Z / 2); | ||
804 | |||
805 | } | ||
806 | else if (maxZ > lower) | ||
807 | { | ||
808 | offsetHeight = maxZ - (boundingBox.Z / 2); | ||
809 | offsetHeight *= -1; | ||
810 | } | ||
811 | |||
798 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); | 812 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); |
799 | return boundingBox; | 813 | return boundingBox; |
800 | } | 814 | } |
801 | |||
802 | #endregion | 815 | #endregion |
803 | 816 | ||
804 | public void SaveScriptedState(XmlTextWriter writer) | 817 | public void SaveScriptedState(XmlTextWriter writer) |