From ce9b1320d273890610a2ccd4f1ada39498135049 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Jun 2013 00:41:46 +0100 Subject: 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. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 75d0667..4b4e4ba 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3038,7 +3038,16 @@ namespace OpenSim.Region.Framework.Scenes // for (int i = 0; i < parts.Length; i++) // 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; Quaternion partRotation = m_rootPart.RotationOffset; diff *= Quaternion.Inverse(partRotation); -- cgit v1.1