Fix physics proxy position when linking and rotating the root prim only

avinationmerge
Melanie 2011-10-06 17:55:20 +02:00
parent 363a99593d
commit 300d357573
1 changed files with 6 additions and 2 deletions

View File

@ -2397,6 +2397,7 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion oldRootRotation = linkPart.RotationOffset; Quaternion oldRootRotation = linkPart.RotationOffset;
linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition; linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
linkPart.ParentID = m_rootPart.LocalId;
linkPart.GroupPosition = AbsolutePosition; linkPart.GroupPosition = AbsolutePosition;
Vector3 axPos = linkPart.OffsetPosition; Vector3 axPos = linkPart.OffsetPosition;
@ -3431,14 +3432,17 @@ namespace OpenSim.Region.Framework.Scenes
if (prim.UUID != m_rootPart.UUID) if (prim.UUID != m_rootPart.UUID)
{ {
prim.IgnoreUndoUpdate = true; prim.IgnoreUndoUpdate = true;
Quaternion NewRot = oldParentRot * prim.RotationOffset;
NewRot = Quaternion.Inverse(axRot) * NewRot;
prim.RotationOffset = NewRot;
Vector3 axPos = prim.OffsetPosition; Vector3 axPos = prim.OffsetPosition;
axPos *= oldParentRot; axPos *= oldParentRot;
axPos *= Quaternion.Inverse(axRot); axPos *= Quaternion.Inverse(axRot);
prim.OffsetPosition = axPos; prim.OffsetPosition = axPos;
prim.RotationOffset *= Quaternion.Inverse(prim.GetWorldRotation()) * (oldParentRot * prim.RotationOffset);
prim.IgnoreUndoUpdate = false; prim.IgnoreUndoUpdate = false;
} }
} }