When moving the root prim of an attachment: a) Change the attach position; b) Move the other prims in the reverse direction to compensate

master-beforevarregion
Oren Hurvitz 2013-09-16 09:42:14 +03:00 committed by Justin Clark-Casey (justincc)
parent 88f01a4130
commit da47bcae3e
1 changed files with 5 additions and 5 deletions

View File

@ -3043,13 +3043,10 @@ namespace OpenSim.Region.Framework.Scenes
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;
oldPos = m_rootPart.AttachedPos + m_rootPart.OffsetPosition; // OffsetPosition should always be 0 in an attachments's root prim
else
oldPos = AbsolutePosition + RootPart.OffsetPosition;
oldPos = AbsolutePosition + m_rootPart.OffsetPosition;
Vector3 diff = oldPos - newPos;
Quaternion partRotation = m_rootPart.RotationOffset;
@ -3064,6 +3061,9 @@ namespace OpenSim.Region.Framework.Scenes
}
AbsolutePosition = newPos;
if (IsAttachment)
m_rootPart.AttachedPos = newPos;
HasGroupChanged = true;
ScheduleGroupForTerseUpdate();