diff options
author | Teravus Ovares | 2008-12-21 14:50:58 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-12-21 14:50:58 +0000 |
commit | bf9e8cb9878a89f16edcd0b86af62aabdd7b93bc (patch) | |
tree | 3b9a530bcb4c8500b183d0fa312a28665c8f22af /OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |
parent | Persist script permission mask and granter (diff) | |
download | opensim-SC_OLD-bf9e8cb9878a89f16edcd0b86af62aabdd7b93bc.zip opensim-SC_OLD-bf9e8cb9878a89f16edcd0b86af62aabdd7b93bc.tar.gz opensim-SC_OLD-bf9e8cb9878a89f16edcd0b86af62aabdd7b93bc.tar.bz2 opensim-SC_OLD-bf9e8cb9878a89f16edcd0b86af62aabdd7b93bc.tar.xz |
* 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
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index f4ccc46..36ba683 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -2132,6 +2132,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
2132 | 2132 | ||
2133 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum) | 2133 | private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum) |
2134 | { | 2134 | { |
2135 | |||
2136 | Quaternion parentRot = oldGroupRotation; | ||
2137 | Quaternion oldRot = part.RotationOffset; | ||
2138 | Quaternion worldRot = parentRot * oldRot; | ||
2139 | |||
2140 | parentRot = oldGroupRotation; | ||
2141 | |||
2142 | Vector3 axPos = part.OffsetPosition; | ||
2143 | |||
2144 | axPos *= parentRot; | ||
2145 | part.OffsetPosition = axPos; | ||
2146 | part.GroupPosition = oldGroupPosition + part.OffsetPosition; | ||
2147 | part.OffsetPosition = Vector3.Zero; | ||
2148 | part.RotationOffset = worldRot; | ||
2149 | |||
2135 | part.SetParent(this); | 2150 | part.SetParent(this); |
2136 | part.ParentID = m_rootPart.LocalId; | 2151 | part.ParentID = m_rootPart.LocalId; |
2137 | 2152 | ||
@@ -2140,11 +2155,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
2140 | 2155 | ||
2141 | part.LinkNum = linkNum; | 2156 | part.LinkNum = linkNum; |
2142 | 2157 | ||
2143 | Vector3 oldPos = part.OffsetPosition; | 2158 | |
2144 | oldPos *= oldGroupRotation; | 2159 | part.OffsetPosition = part.GroupPosition - AbsolutePosition; |
2145 | oldPos += oldGroupPosition; | ||
2146 | Vector3 oldAbsolutePosition = oldPos; | ||
2147 | part.OffsetPosition = oldAbsolutePosition - AbsolutePosition; | ||
2148 | 2160 | ||
2149 | Quaternion rootRotation = m_rootPart.RotationOffset; | 2161 | Quaternion rootRotation = m_rootPart.RotationOffset; |
2150 | 2162 | ||
@@ -2152,11 +2164,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
2152 | pos *= Quaternion.Inverse(rootRotation); | 2164 | pos *= Quaternion.Inverse(rootRotation); |
2153 | part.OffsetPosition = pos; | 2165 | part.OffsetPosition = pos; |
2154 | 2166 | ||
2155 | Quaternion partRotation = part.RotationOffset; | 2167 | parentRot = m_rootPart.RotationOffset; |
2156 | 2168 | oldRot = part.RotationOffset; | |
2157 | partRotation *= oldGroupRotation; | 2169 | Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot; |
2158 | partRotation *= Quaternion.Inverse(rootRotation); | 2170 | part.RotationOffset = newRot; |
2159 | part.RotationOffset = partRotation; | ||
2160 | } | 2171 | } |
2161 | 2172 | ||
2162 | /// <summary> | 2173 | /// <summary> |