From 4b00203fa5d1ae645cf7bd67d061ee751d5c447b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 25 Jun 2013 00:15:55 +0100 Subject: Tidy up SOG.UpdateRootPosition() to eliminate unnecessary copying of Vector3 structs --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index f1036ae..75d0667 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3028,8 +3028,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Update just the root prim position in a linkset /// - /// - public void UpdateRootPosition(Vector3 pos) + /// + public void UpdateRootPosition(Vector3 newPos) { // m_log.DebugFormat( // "[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++) // parts[i].StoreUndoState(); - Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); - Vector3 oldPos = - new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, - AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, - AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); + Vector3 oldPos = AbsolutePosition + RootPart.OffsetPosition; Vector3 diff = oldPos - newPos; - Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); Quaternion partRotation = m_rootPart.RotationOffset; - axDiff *= Quaternion.Inverse(partRotation); - diff = axDiff; + diff *= Quaternion.Inverse(partRotation); SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) -- cgit v1.1