Update of /cvsroot/opal/opal/src/ODE
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21144/src/ODE
Modified Files:
ODESimulator.cpp
Log Message:
Fixed bug where collisions between two static Solids (at least one of them using a CollisionEventHandler) caused a crash in an ODE function call. Thanks to EarthquakeProof in the forum for catching this.
Index: ODESimulator.cpp
===================================================================
RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v
retrieving revision 1.104
retrieving revision 1.105
diff -C2 -d -r1.104 -r1.105
*** ODESimulator.cpp 24 Jun 2005 16:40:49 -0000 1.104
--- ODESimulator.cpp 24 Jun 2005 18:46:29 -0000 1.105
***************
*** 344,352 ****
// contacts) with contacts disabled (note: both must have
// bodies to check this): this is enforced.
! // 6. Solid0 is static, Solid1 is sleeping,
// static-to-sleeping contacts are ignored by the
// Simulator, and neither Solid has a
// CollisionEventHandler: this is enforced.
! // 7. Solid1 is static, Solid0 is sleeping,
// static-to-sleeping contacts are ignored by the
// Simulator, and neither Solid has a
--- 344,352 ----
// contacts) with contacts disabled (note: both must have
// bodies to check this): this is enforced.
! // 6. Solid0 is static, Solid1 is dynamic and is sleeping,
// static-to-sleeping contacts are ignored by the
// Simulator, and neither Solid has a
// CollisionEventHandler: this is enforced.
! // 7. Solid1 is static, Solid0 is dynamic and is sleeping,
// static-to-sleeping contacts are ignored by the
// Simulator, and neither Solid has a
***************
*** 415,420 ****
bool neitherHasEventHandler = !(handler0 || handler1);
! // It is important here that we don't check if a static body
! // is disabled (sleeping) because that crashes ODE.
if ((neitherHasEventHandler
&& solid0Static && solid1Static) //case 1
--- 415,421 ----
bool neitherHasEventHandler = !(handler0 || handler1);
! // Now do the actual tests to see if we should return early.
! // It is important here that we don't call dBodyIsEnabled on
! // a static body because that crashes ODE.
if ((neitherHasEventHandler
&& solid0Static && solid1Static) //case 1
***************
*** 426,433 ****
|| (commonJoint
&& !commonJoint->areContactsEnabled()) // case 5
! || (solid0Static && !dBodyIsEnabled(o1BodyID)
&& ignoreStaticSleepingContacts
&& neitherHasEventHandler) //case 6
! || (solid1Static && !dBodyIsEnabled(o0BodyID)
&& ignoreStaticSleepingContacts
&& neitherHasEventHandler) //case 7
--- 427,436 ----
|| (commonJoint
&& !commonJoint->areContactsEnabled()) // case 5
! || (solid0Static && 0 != o1BodyID
! && !dBodyIsEnabled(o1BodyID)
&& ignoreStaticSleepingContacts
&& neitherHasEventHandler) //case 6
! || (solid1Static && 0 != o0BodyID
! && !dBodyIsEnabled(o0BodyID)
&& ignoreStaticSleepingContacts
&& neitherHasEventHandler) //case 7
|