diff options
author | Justin Clark-Casey (justincc) | 2013-06-25 00:15:55 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-06-25 00:15:55 +0100 |
commit | 4b00203fa5d1ae645cf7bd67d061ee751d5c447b (patch) | |
tree | 9afd79a506919cd085c41a180de6ae2200eb4e8d /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-4b00203fa5d1ae645cf7bd67d061ee751d5c447b.zip opensim-SC_OLD-4b00203fa5d1ae645cf7bd67d061ee751d5c447b.tar.gz opensim-SC_OLD-4b00203fa5d1ae645cf7bd67d061ee751d5c447b.tar.bz2 opensim-SC_OLD-4b00203fa5d1ae645cf7bd67d061ee751d5c447b.tar.xz |
Tidy up SOG.UpdateRootPosition() to eliminate unnecessary copying of Vector3 structs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 14 |
1 files changed, 4 insertions, 10 deletions
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 | |||
3028 | /// <summary> | 3028 | /// <summary> |
3029 | /// Update just the root prim position in a linkset | 3029 | /// Update just the root prim position in a linkset |
3030 | /// </summary> | 3030 | /// </summary> |
3031 | /// <param name="pos"></param> | 3031 | /// <param name="newPos"></param> |
3032 | public void UpdateRootPosition(Vector3 pos) | 3032 | public void UpdateRootPosition(Vector3 newPos) |
3033 | { | 3033 | { |
3034 | // m_log.DebugFormat( | 3034 | // m_log.DebugFormat( |
3035 | // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); | 3035 | // "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos); |
@@ -3038,16 +3038,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3038 | // for (int i = 0; i < parts.Length; i++) | 3038 | // for (int i = 0; i < parts.Length; i++) |
3039 | // parts[i].StoreUndoState(); | 3039 | // parts[i].StoreUndoState(); |
3040 | 3040 | ||
3041 | Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); | 3041 | Vector3 oldPos = AbsolutePosition + RootPart.OffsetPosition; |
3042 | Vector3 oldPos = | ||
3043 | new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X, | ||
3044 | AbsolutePosition.Y + m_rootPart.OffsetPosition.Y, | ||
3045 | AbsolutePosition.Z + m_rootPart.OffsetPosition.Z); | ||
3046 | Vector3 diff = oldPos - newPos; | 3042 | Vector3 diff = oldPos - newPos; |
3047 | Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z); | ||
3048 | Quaternion partRotation = m_rootPart.RotationOffset; | 3043 | Quaternion partRotation = m_rootPart.RotationOffset; |
3049 | axDiff *= Quaternion.Inverse(partRotation); | 3044 | diff *= Quaternion.Inverse(partRotation); |
3050 | diff = axDiff; | ||
3051 | 3045 | ||
3052 | SceneObjectPart[] parts = m_parts.GetArray(); | 3046 | SceneObjectPart[] parts = m_parts.GetArray(); |
3053 | for (int i = 0; i < parts.Length; i++) | 3047 | for (int i = 0; i < parts.Length; i++) |