aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs35
1 files changed, 12 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index e05562a..a20bbc3 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -98,19 +98,6 @@ public sealed class BSLinksetCompound : BSLinkset
98 { 98 {
99 } 99 }
100 100
101 // For compound implimented linksets, if there are children, use compound shape for the root.
102 public override BSPhysicsShapeType PreferredPhysicalShape(BSPrimLinkable requestor)
103 {
104 // Returning 'unknown' means we don't have a preference.
105 BSPhysicsShapeType ret = BSPhysicsShapeType.SHAPE_UNKNOWN;
106 if (IsRoot(requestor) && HasAnyChildren)
107 {
108 ret = BSPhysicsShapeType.SHAPE_COMPOUND;
109 }
110 // DetailLog("{0},BSLinksetCompound.PreferredPhysicalShape,call,shape={1}", LinksetRoot.LocalID, ret);
111 return ret;
112 }
113
114 // When physical properties are changed the linkset needs to recalculate 101 // When physical properties are changed the linkset needs to recalculate
115 // its internal properties. 102 // its internal properties.
116 public override void Refresh(BSPrimLinkable requestor) 103 public override void Refresh(BSPrimLinkable requestor)
@@ -218,22 +205,22 @@ public sealed class BSLinksetCompound : BSLinkset
218 // and that is caused by us updating the object. 205 // and that is caused by us updating the object.
219 if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0) 206 if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
220 { 207 {
221 // Find the physical instance of the child 208 // Find the physical instance of the child
222 if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape)) 209 if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape.physShapeInfo))
223 { 210 {
224 // It is possible that the linkset is still under construction and the child is not yet 211 // It is possible that the linkset is still under construction and the child is not yet
225 // inserted into the compound shape. A rebuild of the linkset in a pre-step action will 212 // inserted into the compound shape. A rebuild of the linkset in a pre-step action will
226 // build the whole thing with the new position or rotation. 213 // build the whole thing with the new position or rotation.
227 // The index must be checked because Bullet references the child array but does no validity 214 // The index must be checked because Bullet references the child array but does no validity
228 // checking of the child index passed. 215 // checking of the child index passed.
229 int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape); 216 int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape.physShapeInfo);
230 if (updated.LinksetChildIndex < numLinksetChildren) 217 if (updated.LinksetChildIndex < numLinksetChildren)
231 { 218 {
232 BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape, updated.LinksetChildIndex); 219 BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex);
233 if (linksetChildShape.HasPhysicalShape) 220 if (linksetChildShape.HasPhysicalShape)
234 { 221 {
235 // Found the child shape within the compound shape 222 // Found the child shape within the compound shape
236 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, updated.LinksetChildIndex, 223 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape.physShapeInfo, updated.LinksetChildIndex,
237 updated.RawPosition - LinksetRoot.RawPosition, 224 updated.RawPosition - LinksetRoot.RawPosition,
238 updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation), 225 updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation),
239 true /* shouldRecalculateLocalAabb */); 226 true /* shouldRecalculateLocalAabb */);
@@ -278,7 +265,7 @@ public sealed class BSLinksetCompound : BSLinkset
278 // Since we don't keep in world relationships, do nothing unless it's a child changing. 265 // Since we don't keep in world relationships, do nothing unless it's a child changing.
279 // Returns 'true' of something was actually removed and would need restoring 266 // Returns 'true' of something was actually removed and would need restoring
280 // Called at taint-time!! 267 // Called at taint-time!!
281 public override bool RemoveBodyDependencies(BSPrimLinkable child) 268 public override bool RemoveDependencies(BSPrimLinkable child)
282 { 269 {
283 bool ret = false; 270 bool ret = false;
284 271
@@ -404,11 +391,12 @@ public sealed class BSLinksetCompound : BSLinkset
404 { 391 {
405 try 392 try
406 { 393 {
394 /*
407 // Suppress rebuilding while rebuilding. (We know rebuilding is on only one thread.) 395 // Suppress rebuilding while rebuilding. (We know rebuilding is on only one thread.)
408 Rebuilding = true; 396 Rebuilding = true;
409 397
410 // Cause the root shape to be rebuilt as a compound object with just the root in it 398 // Cause the root shape to be rebuilt as a compound object with just the root in it
411 LinksetRoot.ForceBodyShapeRebuild(true /* inTaintTime */); 399 LinksetRoot.ForceBodyShapeRebuild(true /* inTaintTime );
412 400
413 // The center of mass for the linkset is the geometric center of the group. 401 // The center of mass for the linkset is the geometric center of the group.
414 // Compute a displacement for each component so it is relative to the center-of-mass. 402 // Compute a displacement for each component so it is relative to the center-of-mass.
@@ -430,10 +418,10 @@ public sealed class BSLinksetCompound : BSLinkset
430 LinksetRoot.ForcePosition = LinksetRoot.RawPosition; 418 LinksetRoot.ForcePosition = LinksetRoot.RawPosition;
431 419
432 // Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM 420 // Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM
433 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0 /* childIndex */, 421 PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape.physShapeInfo, 0 /* childIndex ,
434 -centerDisplacement, 422 -centerDisplacement,
435 OMV.Quaternion.Identity, // LinksetRoot.RawOrientation, 423 OMV.Quaternion.Identity, // LinksetRoot.RawOrientation,
436 false /* shouldRecalculateLocalAabb (is done later after linkset built) */); 424 false /* shouldRecalculateLocalAabb (is done later after linkset built) );
437 425
438 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", 426 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}",
439 LinksetRoot.LocalID, centerOfMassW, LinksetRoot.RawPosition, centerDisplacement); 427 LinksetRoot.LocalID, centerOfMassW, LinksetRoot.RawPosition, centerDisplacement);
@@ -501,6 +489,7 @@ public sealed class BSLinksetCompound : BSLinkset
501 489
502 // Enable the physical position updator to return the position and rotation of the root shape 490 // Enable the physical position updator to return the position and rotation of the root shape
503 PhysicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE); 491 PhysicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE);
492 */
504 } 493 }
505 finally 494 finally
506 { 495 {
@@ -508,7 +497,7 @@ public sealed class BSLinksetCompound : BSLinkset
508 } 497 }
509 498
510 // See that the Aabb surrounds the new shape 499 // See that the Aabb surrounds the new shape
511 PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape); 500 PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape.physShapeInfo);
512 } 501 }
513} 502}
514} \ No newline at end of file 503} \ No newline at end of file