* Fixes linking multiple linksets together. They no longer explode

* Not out of the weeds yet.  Rotating the root part with 'edit linked parts' still borks all child part rotations and rotating a selection of child parts with 'edit linked parts' still borks the position/rotation of the child parts selected
0.6.2-post-fixes
Teravus Ovares 2008-12-21 14:50:58 +00:00
parent d7a19adcac
commit bf9e8cb987
2 changed files with 24 additions and 10 deletions

View File

@ -1690,6 +1690,9 @@ namespace OpenSim.Region.Environment.Scenes
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0);
copy.HasGroupChanged = true; copy.HasGroupChanged = true;
copy.ScheduleGroupForFullUpdate(); copy.ScheduleGroupForFullUpdate();
// required for physics to update it's position
copy.AbsolutePosition = copy.AbsolutePosition;
return copy; return copy;
} }
} }

View File

@ -2132,6 +2132,21 @@ namespace OpenSim.Region.Environment.Scenes
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum) private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
{ {
Quaternion parentRot = oldGroupRotation;
Quaternion oldRot = part.RotationOffset;
Quaternion worldRot = parentRot * oldRot;
parentRot = oldGroupRotation;
Vector3 axPos = part.OffsetPosition;
axPos *= parentRot;
part.OffsetPosition = axPos;
part.GroupPosition = oldGroupPosition + part.OffsetPosition;
part.OffsetPosition = Vector3.Zero;
part.RotationOffset = worldRot;
part.SetParent(this); part.SetParent(this);
part.ParentID = m_rootPart.LocalId; part.ParentID = m_rootPart.LocalId;
@ -2140,11 +2155,8 @@ namespace OpenSim.Region.Environment.Scenes
part.LinkNum = linkNum; part.LinkNum = linkNum;
Vector3 oldPos = part.OffsetPosition;
oldPos *= oldGroupRotation; part.OffsetPosition = part.GroupPosition - AbsolutePosition;
oldPos += oldGroupPosition;
Vector3 oldAbsolutePosition = oldPos;
part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
Quaternion rootRotation = m_rootPart.RotationOffset; Quaternion rootRotation = m_rootPart.RotationOffset;
@ -2152,11 +2164,10 @@ namespace OpenSim.Region.Environment.Scenes
pos *= Quaternion.Inverse(rootRotation); pos *= Quaternion.Inverse(rootRotation);
part.OffsetPosition = pos; part.OffsetPosition = pos;
Quaternion partRotation = part.RotationOffset; parentRot = m_rootPart.RotationOffset;
oldRot = part.RotationOffset;
partRotation *= oldGroupRotation; Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
partRotation *= Quaternion.Inverse(rootRotation); part.RotationOffset = newRot;
part.RotationOffset = partRotation;
} }
/// <summary> /// <summary>