Tidy up SOG.UpdateRootPosition() to eliminate unnecessary copying of Vector3 structs
parent
936700bda3
commit
4b00203fa5
|
@ -3028,8 +3028,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update just the root prim position in a linkset
|
/// Update just the root prim position in a linkset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pos"></param>
|
/// <param name="newPos"></param>
|
||||||
public void UpdateRootPosition(Vector3 pos)
|
public void UpdateRootPosition(Vector3 newPos)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos);
|
// "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos);
|
||||||
|
@ -3038,16 +3038,10 @@ 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 newPos = new Vector3(pos.X, pos.Y, pos.Z);
|
Vector3 oldPos = AbsolutePosition + RootPart.OffsetPosition;
|
||||||
Vector3 oldPos =
|
|
||||||
new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
|
|
||||||
AbsolutePosition.Y + m_rootPart.OffsetPosition.Y,
|
|
||||||
AbsolutePosition.Z + m_rootPart.OffsetPosition.Z);
|
|
||||||
Vector3 diff = oldPos - newPos;
|
Vector3 diff = oldPos - newPos;
|
||||||
Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
|
|
||||||
Quaternion partRotation = m_rootPart.RotationOffset;
|
Quaternion partRotation = m_rootPart.RotationOffset;
|
||||||
axDiff *= Quaternion.Inverse(partRotation);
|
diff *= Quaternion.Inverse(partRotation);
|
||||||
diff = axDiff;
|
|
||||||
|
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
|
|
Loading…
Reference in New Issue