aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs54
1 files changed, 36 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index d2abdb4..6cabe3a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -114,6 +114,12 @@ public sealed class BSLinksetCompound : BSLinkset
114 { 114 {
115 // The root is going dynamic. Make sure mass is properly set. 115 // The root is going dynamic. Make sure mass is properly set.
116 m_mass = ComputeLinksetMass(); 116 m_mass = ComputeLinksetMass();
117 if (HasAnyChildren)
118 {
119 // Schedule a rebuilding as this will construct the complete compound shape
120 // and set all the properties correctly.
121 InternalRefresh(LinksetRoot);
122 }
117 } 123 }
118 else 124 else
119 { 125 {
@@ -123,6 +129,9 @@ public sealed class BSLinksetCompound : BSLinkset
123 BulletSimAPI.ForceActivationState2(child.PhysBody.ptr, ActivationState.DISABLE_SIMULATION); 129 BulletSimAPI.ForceActivationState2(child.PhysBody.ptr, ActivationState.DISABLE_SIMULATION);
124 // We don't want collisions from the old linkset children. 130 // We don't want collisions from the old linkset children.
125 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 131 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
132
133 child.PhysBody.collisionType = CollisionType.LinksetChild;
134
126 ret = true; 135 ret = true;
127 } 136 }
128 return ret; 137 return ret;
@@ -137,10 +146,21 @@ public sealed class BSLinksetCompound : BSLinkset
137 { 146 {
138 bool ret = false; 147 bool ret = false;
139 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child)); 148 DetailLog("{0},BSLinksetCompound.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child));
140 if (!IsRoot(child)) 149 if (IsRoot(child))
150 {
151 if (HasAnyChildren)
152 {
153 // Schedule a rebuilding as this will construct the complete compound shape
154 // and set all the properties correctly.
155 InternalRefresh(LinksetRoot);
156 }
157 }
158 else
141 { 159 {
142 // The non-physical children can come back to life. 160 // The non-physical children can come back to life.
143 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 161 BulletSimAPI.RemoveFromCollisionFlags2(child.PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE);
162 child.PhysBody.collisionType = CollisionType.LinksetChild;
163
144 // Don't force activation so setting of DISABLE_SIMULATION can stay if used. 164 // Don't force activation so setting of DISABLE_SIMULATION can stay if used.
145 BulletSimAPI.Activate2(child.PhysBody.ptr, false); 165 BulletSimAPI.Activate2(child.PhysBody.ptr, false);
146 ret = true; 166 ret = true;
@@ -182,19 +202,25 @@ public sealed class BSLinksetCompound : BSLinkset
182 // Because it is a convenient time, recompute child world position and rotation based on 202 // Because it is a convenient time, recompute child world position and rotation based on
183 // its position in the linkset. 203 // its position in the linkset.
184 RecomputeChildWorldPosition(child, true); 204 RecomputeChildWorldPosition(child, true);
185
186 // Cause the current shape to be freed and the new one to be built.
187 InternalRefresh(LinksetRoot);
188 ret = true;
189 } 205 }
190 206
207 // Cannot schedule a refresh/rebuild here because this routine is called when
208 // the linkset is being rebuilt.
209 // InternalRefresh(LinksetRoot);
210
191 return ret; 211 return ret;
192 } 212 }
193 213
194 // When the linkset is built, the child shape is added 214 // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true',
195 // to the compound shape relative to the root shape. The linkset then moves around but 215 // this routine will restore the removed constraints.
196 // this does not move the actual child prim. The child prim's location must be recomputed 216 // Called at taint-time!!
197 // based on the location of the root shape. 217 public override void RestoreBodyDependencies(BSPrim child)
218 {
219 }
220
221 // When the linkset is built, the child shape is added to the compound shape relative to the
222 // root shape. The linkset then moves around but this does not move the actual child
223 // prim. The child prim's location must be recomputed based on the location of the root shape.
198 private void RecomputeChildWorldPosition(BSPhysObject child, bool inTaintTime) 224 private void RecomputeChildWorldPosition(BSPhysObject child, bool inTaintTime)
199 { 225 {
200 BSLinksetCompoundInfo lci = child.LinksetInfo as BSLinksetCompoundInfo; 226 BSLinksetCompoundInfo lci = child.LinksetInfo as BSLinksetCompoundInfo;
@@ -227,14 +253,6 @@ public sealed class BSLinksetCompound : BSLinkset
227 } 253 }
228 } 254 }
229 255
230 // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true',
231 // this routine will restore the removed constraints.
232 // Called at taint-time!!
233 public override void RestoreBodyDependencies(BSPrim child)
234 {
235 // The Refresh operation queued by RemoveBodyDependencies() will build any missing constraints.
236 }
237
238 // ================================================================ 256 // ================================================================
239 257
240 // Add a new child to the linkset. 258 // Add a new child to the linkset.
@@ -254,7 +272,7 @@ public sealed class BSLinksetCompound : BSLinkset
254 } 272 }
255 273
256 // Remove the specified child from the linkset. 274 // Remove the specified child from the linkset.
257 // Safe to call even if the child is not really in my linkset. 275 // Safe to call even if the child is not really in the linkset.
258 protected override void RemoveChildFromLinkset(BSPhysObject child) 276 protected override void RemoveChildFromLinkset(BSPhysObject child)
259 { 277 {
260 if (m_children.Remove(child)) 278 if (m_children.Remove(child))