aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMW2009-07-15 19:46:32 +0000
committerMW2009-07-15 19:46:32 +0000
commita266e6dc4b4cfee3ccc3de97dbe6be350aabdef5 (patch)
tree727ae3a6f6e6520dae55bbb31621aa18b3b18686 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentYet more work on fixing the boundingbox code. (diff)
downloadopensim-SC_OLD-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.zip
opensim-SC_OLD-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.tar.gz
opensim-SC_OLD-a266e6dc4b4cfee3ccc3de97dbe6be350aabdef5.tar.bz2
opensim-SC_OLD-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 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs23
1 files changed, 18 insertions, 5 deletions
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)