Improve situation where editing just the root prim of an attachment causes other prims to be set to very far off positions on reattach.

Functionally the same as the patch by tglion in http://opensimulator.org/mantis/view.php?id=5334
However, not yet perfect - after editing just root prim on reattach the position is still wrong, though other prims are not set to far off positions.
cpu-performance
Justin Clark-Casey (justincc) 2013-06-25 00:41:46 +01:00
parent 4b00203fa5
commit ce9b1320d2
1 changed files with 10 additions and 1 deletions

View File

@ -3038,7 +3038,16 @@ namespace OpenSim.Region.Framework.Scenes
// for (int i = 0; i < parts.Length; i++) // for (int i = 0; i < parts.Length; i++)
// parts[i].StoreUndoState(); // parts[i].StoreUndoState();
Vector3 oldPos = AbsolutePosition + RootPart.OffsetPosition; Vector3 oldPos;
// FIXME: This improves the situation where editing just the root prim of an attached object would send
// all the other parts to oblivion after detach/reattach. However, a problem remains since the root prim
// still ends up in the wrong position on reattach.
if (IsAttachment)
oldPos = RootPart.OffsetPosition;
else
oldPos = AbsolutePosition + RootPart.OffsetPosition;
Vector3 diff = oldPos - newPos; Vector3 diff = oldPos - newPos;
Quaternion partRotation = m_rootPart.RotationOffset; Quaternion partRotation = m_rootPart.RotationOffset;
diff *= Quaternion.Inverse(partRotation); diff *= Quaternion.Inverse(partRotation);