diff options
author | Justin Clarke Casey | 2008-02-13 14:45:32 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-02-13 14:45:32 +0000 |
commit | 3624efde85e17be4185c7dca7365412303025b05 (patch) | |
tree | 15c0c99e07ca694f28c789c432d7d37eec8b72e6 | |
parent | Added a method to access a named folder in a users inventory, to the inventor... (diff) | |
download | opensim-SC-3624efde85e17be4185c7dca7365412303025b05.zip opensim-SC-3624efde85e17be4185c7dca7365412303025b05.tar.gz opensim-SC-3624efde85e17be4185c7dca7365412303025b05.tar.bz2 opensim-SC-3624efde85e17be4185c7dca7365412303025b05.tar.xz |
* Make code fix to address prim rotation unlink issues (mantis 383, 454. 369)
* Many thanks to alex_carnell for the necessary information for this
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 117bcbc..aa2f2d0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -868,12 +868,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
868 | #region Packet Handlers | 868 | #region Packet Handlers |
869 | 869 | ||
870 | /// <summary> | 870 | /// <summary> |
871 | /// | 871 | /// Link the prims in a given group to this group |
872 | /// </summary> | 872 | /// </summary> |
873 | /// <param name="objectGroup"></param> | 873 | /// <param name="objectGroup">The group of prims which should be linked to this group</param> |
874 | public void LinkToGroup(SceneObjectGroup objectGroup) | 874 | public void LinkToGroup(SceneObjectGroup objectGroup) |
875 | { | 875 | { |
876 | SceneObjectPart linkPart = objectGroup.m_rootPart; | 876 | SceneObjectPart linkPart = objectGroup.m_rootPart; |
877 | |||
877 | Vector3 oldGroupPosition = | 878 | Vector3 oldGroupPosition = |
878 | new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); | 879 | new Vector3(linkPart.GroupPosition.X, linkPart.GroupPosition.Y, linkPart.GroupPosition.Z); |
879 | Quaternion oldRootRotation = | 880 | Quaternion oldRootRotation = |
@@ -882,20 +883,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
882 | 883 | ||
883 | linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition; | 884 | linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition; |
884 | linkPart.GroupPosition = AbsolutePosition; | 885 | linkPart.GroupPosition = AbsolutePosition; |
885 | |||
886 | Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); | 886 | Vector3 axPos = new Vector3(linkPart.OffsetPosition.X, linkPart.OffsetPosition.Y, linkPart.OffsetPosition.Z); |
887 | |||
887 | Quaternion parentRot = | 888 | Quaternion parentRot = |
888 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, | 889 | new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, |
889 | m_rootPart.RotationOffset.Z); | 890 | m_rootPart.RotationOffset.Z); |
890 | axPos = parentRot.Inverse()*axPos; | 891 | axPos = parentRot.Inverse()*axPos; |
892 | |||
891 | linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); | 893 | linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); |
892 | Quaternion oldRot = | 894 | Quaternion oldRot = |
893 | new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, | 895 | new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, |
894 | linkPart.RotationOffset.Z); | 896 | linkPart.RotationOffset.Z); |
895 | Quaternion newRot = parentRot.Inverse()*oldRot; | 897 | Quaternion newRot = parentRot.Inverse()*oldRot; |
896 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 898 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
899 | |||
897 | linkPart.ParentID = m_rootPart.LocalID; | 900 | linkPart.ParentID = m_rootPart.LocalID; |
898 | linkPart.LinkNum = m_parts.Count; | 901 | linkPart.LinkNum = m_parts.Count; |
902 | |||
899 | m_parts.Add(linkPart.UUID, linkPart); | 903 | m_parts.Add(linkPart.UUID, linkPart); |
900 | linkPart.SetParent(this); | 904 | linkPart.SetParent(this); |
901 | 905 | ||
@@ -935,7 +939,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
935 | 939 | ||
936 | if (null != linkPart) | 940 | if (null != linkPart) |
937 | { | 941 | { |
938 | 942 | LLQuaternion worldRot = linkPart.GetWorldRotation(); | |
943 | |||
939 | // Remove the part from this object | 944 | // Remove the part from this object |
940 | m_parts.Remove(linkPart.UUID); | 945 | m_parts.Remove(linkPart.UUID); |
941 | linkPart.ParentID = 0; | 946 | linkPart.ParentID = 0; |
@@ -944,8 +949,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
944 | { | 949 | { |
945 | m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); | 950 | m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor); |
946 | } | 951 | } |
952 | |||
947 | // We need to reset the child part's position | 953 | // We need to reset the child part's position |
948 | // ready for life as a separate object after being a part of another object | 954 | // ready for life as a separate object after being a part of another object |
949 | Quaternion parentRot | 955 | Quaternion parentRot |
950 | = new Quaternion( | 956 | = new Quaternion( |
951 | m_rootPart.RotationOffset.W, | 957 | m_rootPart.RotationOffset.W, |
@@ -964,6 +970,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
964 | linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; | 970 | linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; |
965 | linkPart.OffsetPosition = new LLVector3(0, 0, 0); | 971 | linkPart.OffsetPosition = new LLVector3(0, 0, 0); |
966 | 972 | ||
973 | linkPart.RotationOffset = worldRot; | ||
974 | |||
975 | // This chunk is probably unnecesary now - delete later on | ||
976 | /* | ||
967 | Quaternion oldRot | 977 | Quaternion oldRot |
968 | = new Quaternion( | 978 | = new Quaternion( |
969 | linkPart.RotationOffset.W, | 979 | linkPart.RotationOffset.W, |
@@ -972,6 +982,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
972 | linkPart.RotationOffset.Z); | 982 | linkPart.RotationOffset.Z); |
973 | Quaternion newRot = parentRot*oldRot; | 983 | Quaternion newRot = parentRot*oldRot; |
974 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); | 984 | linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); |
985 | */ | ||
975 | 986 | ||
976 | // Add physics information back to delinked part if appropriate | 987 | // Add physics information back to delinked part if appropriate |
977 | // XXX This is messy and should be refactorable with the similar section in | 988 | // XXX This is messy and should be refactorable with the similar section in |