diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index de77862..d0de5f2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -596,14 +596,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
596 | /// <returns></returns> | 596 | /// <returns></returns> |
597 | public Vector3 GetAxisAlignedBoundingBox() | 597 | public Vector3 GetAxisAlignedBoundingBox() |
598 | { | 598 | { |
599 | float maxX = 0f, maxY = 0f, maxZ = 0f, minX = 256f, minY = 256f, minZ = 256f; | 599 | float maxX = -256f, maxY = -256f, maxZ = -256f, minX = 256f, minY = 256f, minZ = 256f; |
600 | lock (m_parts) | 600 | lock (m_parts) |
601 | { | 601 | { |
602 | foreach (SceneObjectPart part in m_parts.Values) | 602 | foreach (SceneObjectPart part in m_parts.Values) |
603 | { | 603 | { |
604 | |||
604 | Vector3 worldPos = part.GetWorldPosition(); | 605 | Vector3 worldPos = part.GetWorldPosition(); |
605 | Vector3 offset = worldPos - AbsolutePosition; | 606 | Vector3 offset = worldPos - AbsolutePosition; |
606 | Quaternion worldRot = part.GetWorldRotation(); | 607 | Quaternion worldRot; |
608 | if (part.ParentID == 0) | ||
609 | { | ||
610 | worldRot = part.RotationOffset; | ||
611 | } | ||
612 | else | ||
613 | { | ||
614 | worldRot = part.GetWorldRotation(); | ||
615 | } | ||
607 | 616 | ||
608 | Vector3 frontTopLeft; | 617 | Vector3 frontTopLeft; |
609 | Vector3 frontTopRight; | 618 | Vector3 frontTopRight; |
@@ -621,35 +630,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
621 | frontTopLeft.Y = orig.Y - (part.Scale.Y / 2); | 630 | frontTopLeft.Y = orig.Y - (part.Scale.Y / 2); |
622 | frontTopLeft.Z = orig.Z + (part.Scale.Z / 2); | 631 | frontTopLeft.Z = orig.Z + (part.Scale.Z / 2); |
623 | 632 | ||
624 | frontTopRight.X = orig.X + (part.Scale.X / 2); | 633 | frontTopRight.X = orig.X - (part.Scale.X / 2); |
625 | frontTopRight.Y = orig.Y - (part.Scale.Y / 2); | 634 | frontTopRight.Y = orig.Y + (part.Scale.Y / 2); |
626 | frontTopRight.Z = orig.Z + (part.Scale.Z / 2); | 635 | frontTopRight.Z = orig.Z + (part.Scale.Z / 2); |
627 | 636 | ||
628 | frontBottomLeft.X = orig.X - (part.Scale.X / 2); | 637 | frontBottomLeft.X = orig.X - (part.Scale.X / 2); |
629 | frontBottomLeft.Y = orig.Y - (part.Scale.Y / 2); | 638 | frontBottomLeft.Y = orig.Y - (part.Scale.Y / 2); |
630 | frontBottomLeft.Z = orig.Z - (part.Scale.Z / 2); | 639 | frontBottomLeft.Z = orig.Z - (part.Scale.Z / 2); |
631 | 640 | ||
632 | frontBottomRight.X = orig.X + (part.Scale.X / 2); | 641 | frontBottomRight.X = orig.X - (part.Scale.X / 2); |
633 | frontBottomRight.Y = orig.Y - (part.Scale.Y / 2); | 642 | frontBottomRight.Y = orig.Y + (part.Scale.Y / 2); |
634 | frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); | 643 | frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); |
635 | 644 | ||
636 | 645 | ||
637 | backTopLeft.X = orig.X - (part.Scale.X / 2); | 646 | backTopLeft.X = orig.X + (part.Scale.X / 2); |
638 | backTopLeft.Y = orig.Y + (part.Scale.Y / 2); | 647 | backTopLeft.Y = orig.Y - (part.Scale.Y / 2); |
639 | backTopLeft.Z = orig.Z + (part.Scale.Z / 2); | 648 | backTopLeft.Z = orig.Z + (part.Scale.Z / 2); |
640 | 649 | ||
641 | backTopRight.X = orig.X + (part.Scale.X / 2); | 650 | backTopRight.X = orig.X + (part.Scale.X / 2); |
642 | backTopRight.Y = orig.Y + (part.Scale.Y / 2); | 651 | backTopRight.Y = orig.Y + (part.Scale.Y / 2); |
643 | backTopRight.Z = orig.Z + (part.Scale.Z / 2); | 652 | backTopRight.Z = orig.Z + (part.Scale.Z / 2); |
644 | 653 | ||
645 | backBottomLeft.X = orig.X - (part.Scale.X / 2); | 654 | backBottomLeft.X = orig.X + (part.Scale.X / 2); |
646 | backBottomLeft.Y = orig.Y + (part.Scale.Y / 2); | 655 | backBottomLeft.Y = orig.Y - (part.Scale.Y / 2); |
647 | backBottomLeft.Z = orig.Z - (part.Scale.Z / 2); | 656 | backBottomLeft.Z = orig.Z - (part.Scale.Z / 2); |
648 | 657 | ||
649 | backBottomRight.X = orig.X + (part.Scale.X / 2); | 658 | backBottomRight.X = orig.X + (part.Scale.X / 2); |
650 | backBottomRight.Y = orig.Y + (part.Scale.Y / 2); | 659 | backBottomRight.Y = orig.Y + (part.Scale.Y / 2); |
651 | backBottomRight.Z = orig.Z - (part.Scale.Z / 2); | 660 | backBottomRight.Z = orig.Z - (part.Scale.Z / 2); |
652 | 661 | ||
662 | |||
653 | frontTopLeft = frontTopLeft * worldRot; | 663 | frontTopLeft = frontTopLeft * worldRot; |
654 | frontTopRight = frontTopRight * worldRot; | 664 | frontTopRight = frontTopRight * worldRot; |
655 | frontBottomLeft = frontBottomLeft * worldRot; | 665 | frontBottomLeft = frontBottomLeft * worldRot; |
@@ -785,7 +795,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
785 | } | 795 | } |
786 | 796 | ||
787 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); | 797 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); |
788 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); | 798 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); |
789 | return boundingBox; | 799 | return boundingBox; |
790 | } | 800 | } |
791 | 801 | ||