aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs27
1 files changed, 19 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2410970..b038876 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -752,6 +752,7 @@ namespace OpenSim.Region.Framework.Scenes
752 return m_groupPosition; 752 return m_groupPosition;
753 } 753 }
754 754
755 // If I'm an attachment, my position is reported as the position of who I'm attached to
755 if (ParentGroup.IsAttachment) 756 if (ParentGroup.IsAttachment)
756 { 757 {
757 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar); 758 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
@@ -779,7 +780,7 @@ namespace OpenSim.Region.Framework.Scenes
779 } 780 }
780 else 781 else
781 { 782 {
782 // To move the child prim in respect to the group position and rotation we have to calculate 783 // The physics engine always sees all objects (root or linked) in world coordinates.
783 actor.Position = GetWorldPosition(); 784 actor.Position = GetWorldPosition();
784 actor.Orientation = GetWorldRotation(); 785 actor.Orientation = GetWorldRotation();
785 } 786 }
@@ -858,6 +859,8 @@ namespace OpenSim.Region.Framework.Scenes
858 { 859 {
859 // We don't want the physics engine mucking up the rotations in a linkset 860 // We don't want the physics engine mucking up the rotations in a linkset
860 PhysicsActor actor = PhysActor; 861 PhysicsActor actor = PhysActor;
862 // If this is a root of a linkset, the real rotation is what the physics engine thinks.
863 // If not a root prim, the offset rotation is computed by SOG and is relative to the root.
861 if (ParentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null) 864 if (ParentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null)
862 { 865 {
863 if (actor.Orientation.X != 0f || actor.Orientation.Y != 0f 866 if (actor.Orientation.X != 0f || actor.Orientation.Y != 0f
@@ -2529,14 +2532,20 @@ namespace OpenSim.Region.Framework.Scenes
2529 /// <returns>A Linked Child Prim objects position in world</returns> 2532 /// <returns>A Linked Child Prim objects position in world</returns>
2530 public Vector3 GetWorldPosition() 2533 public Vector3 GetWorldPosition()
2531 { 2534 {
2532 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2535 Vector3 ret;
2533 Vector3 axPos = OffsetPosition; 2536 if (_parentID == 0)
2534 axPos *= parentRot; 2537 // if a root SOP, my position is what it is
2535 Vector3 translationOffsetPosition = axPos; 2538 ret = GroupPosition;
2536 if(_parentID == 0)
2537 return GroupPosition;
2538 else 2539 else
2539 return ParentGroup.AbsolutePosition + translationOffsetPosition; 2540 {
2541 // If a child SOP, my position is relative to the root SOP so take
2542 // my info and add the root's position and rotation to
2543 // get my world position.
2544 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2545 Vector3 translationOffsetPosition = OffsetPosition * parentRot;
2546 ret = ParentGroup.AbsolutePosition + translationOffsetPosition;
2547 }
2548 return ret;
2540 } 2549 }
2541 2550
2542 /// <summary> 2551 /// <summary>
@@ -2553,6 +2562,8 @@ namespace OpenSim.Region.Framework.Scenes
2553 } 2562 }
2554 else 2563 else
2555 { 2564 {
2565 // A child SOP's rotation is relative to the root SOP's rotation.
2566 // Combine them to get my absolute rotation.
2556 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2567 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2557 Quaternion oldRot = RotationOffset; 2568 Quaternion oldRot = RotationOffset;
2558 newRot = parentRot * oldRot; 2569 newRot = parentRot * oldRot;