Fix issues with UpdateRootRotation and also increase efficiency

avinationmerge
Tom 2011-03-27 13:09:19 -07:00
parent 8338b74d3f
commit 553a195493
1 changed files with 8 additions and 7 deletions

View File

@ -3393,7 +3393,9 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.Undoing = true; m_rootPart.Undoing = true;
cancelUndo = true; cancelUndo = true;
} }
m_rootPart.UpdateRotation(rot);
//Don't use UpdateRotation because it schedules an update prematurely
m_rootPart.RotationOffset = rot;
if (m_rootPart.PhysActor != null) if (m_rootPart.PhysActor != null)
{ {
m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset; m_rootPart.PhysActor.Orientation = m_rootPart.RotationOffset;
@ -3408,14 +3410,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
prim.IgnoreUndoUpdate = true; prim.IgnoreUndoUpdate = true;
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;
Quaternion primsRot = prim.RotationOffset;
Quaternion newRot = primsRot * oldParentRot; prim.RotationOffset *= Quaternion.Inverse(prim.GetWorldRotation()) * (oldParentRot * prim.RotationOffset);
newRot *= Quaternion.Inverse(axRot);
prim.RotationOffset = newRot;
prim.ScheduleTerseUpdate();
prim.IgnoreUndoUpdate = false; prim.IgnoreUndoUpdate = false;
} }
} }
@ -3424,7 +3425,7 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.Undoing = false; m_rootPart.Undoing = false;
} }
m_rootPart.ScheduleTerseUpdate(); ScheduleGroupForTerseUpdate();
} }
#endregion #endregion