diff options
author | Robert Adams | 2014-07-17 21:41:39 -0700 |
---|---|---|
committer | Justin Clark-Casey | 2014-08-02 00:54:54 +0100 |
commit | db17f98c6f87425c861bc39ea04f29a42238a7f3 (patch) | |
tree | 4ed105cc37579e85ebf29c229e0503abbe46c282 | |
parent | fix all instances of "non-existant" to "non-existent" (spelling mistakes) tha... (diff) | |
download | opensim-SC-db17f98c6f87425c861bc39ea04f29a42238a7f3.zip opensim-SC-db17f98c6f87425c861bc39ea04f29a42238a7f3.tar.gz opensim-SC-db17f98c6f87425c861bc39ea04f29a42238a7f3.tar.bz2 opensim-SC-db17f98c6f87425c861bc39ea04f29a42238a7f3.tar.xz |
BulletSim: rearrange code to prevent using null pointers when a
child mesh is not available when building a linkset.
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 5217452..5a9e9ff 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -385,6 +385,16 @@ public sealed class BSLinksetCompound : BSLinkset | |||
385 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); | 385 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); |
386 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", | 386 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", |
387 | LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot); | 387 | LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot); |
388 | |||
389 | // Since we are borrowing the shape of the child, disable the origional child body | ||
390 | if (!IsRoot(cPrim)) | ||
391 | { | ||
392 | m_physicsScene.PE.AddToCollisionFlags(cPrim.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); | ||
393 | m_physicsScene.PE.ForceActivationState(cPrim.PhysBody, ActivationState.DISABLE_SIMULATION); | ||
394 | // We don't want collisions from the old linkset children. | ||
395 | m_physicsScene.PE.RemoveFromCollisionFlags(cPrim.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
396 | cPrim.PhysBody.collisionType = CollisionType.LinksetChild; | ||
397 | } | ||
388 | } | 398 | } |
389 | else | 399 | else |
390 | { | 400 | { |
@@ -404,20 +414,9 @@ public sealed class BSLinksetCompound : BSLinkset | |||
404 | m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader); | 414 | m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader); |
405 | m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}", | 415 | m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}", |
406 | LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape); | 416 | LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape); |
407 | return false; // 'false' says to move onto the next child in the list | ||
408 | } | 417 | } |
409 | } | 418 | } |
410 | 419 | ||
411 | // Since we are borrowing the shape of the child, disable the origional child body | ||
412 | if (!IsRoot(cPrim)) | ||
413 | { | ||
414 | m_physicsScene.PE.AddToCollisionFlags(cPrim.PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); | ||
415 | m_physicsScene.PE.ForceActivationState(cPrim.PhysBody, ActivationState.DISABLE_SIMULATION); | ||
416 | // We don't want collisions from the old linkset children. | ||
417 | m_physicsScene.PE.RemoveFromCollisionFlags(cPrim.PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | ||
418 | cPrim.PhysBody.collisionType = CollisionType.LinksetChild; | ||
419 | } | ||
420 | |||
421 | return false; // 'false' says to move onto the next child in the list | 420 | return false; // 'false' says to move onto the next child in the list |
422 | }); | 421 | }); |
423 | 422 | ||