CharacterFilter and softbodies - crash [SOLVED]

mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

CharacterFilter and softbodies - crash [SOLVED]

Post by mi076 »

Hello,

i have tried to use btBroadphaseProxy::CharacterFilter. I am using it with my kinematic character class (similar to to the version before ghost object). I do
m_collisionObject->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT);
and
m_dynamicsWorld->addCollisionObject(m_character->getCollisionObject(),
btBroadphaseProxy::CharacterFilter,
btBroadphaseProxy::StaticFilter |
btBroadphaseProxy::DefaultFilter);

It works. Character interacts with dynamic objects. But i have found out that
application crashes if the character collides with softbodies.
If i change
m_dynamicsWorld->addCollisionObject(m_character->getCollisionObject(),
btBroadphaseProxy::DebrisFilter,
btBroadphaseProxy::StaticFilter);
it doesn't happen, setCollisionFlags doesn't matter. Here is buggy test version.

http://game-ws.googlecode.com/files/gws-bug.zip

The softbody is a rope (blue line), see attachment. Character moves like
in Quake (W,S,D,A and mouse). Tip (Press F10 to release the cursor, ESC to quit, F8 - debug mode). Just run forward closer to the rope to crash...

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1235179808 (LWP 4292)]
0x080aa46c in btSoftBody::defaultCollisionHandler ()
(gdb) up
#1 0x080eb9a0 in btCollisionDispatcher::defaultNearCallback ()
(gdb) up
#2 0x080eba93 in btCollisionPairCallback::processOverlap ()
(gdb) up
#3 0x080e924e in btHashedOverlappingPairCache::processAllOverlappingPairs ()
(gdb) up
#4 0x080eb5b2 in btCollisionDispatcher::dispatchAllCollisionPairs ()
(gdb) up
#5 0x080ec24d in btCollisionWorld::performDiscreteCollisionDetection ()
(gdb) up
#6 0x080d62c7 in btDiscreteDynamicsWorld::internalSingleStepSimulation ()
(gdb) up
#7 0x080cc539 in btSoftRigidDynamicsWorld::internalSingleStepSimulation ()
(gdb) up
#8 0x080d491f in btDiscreteDynamicsWorld::stepSimulation ()
(gdb) up
You do not have the required permissions to view the files attached to this post.
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: btBroadphaseProxy::CharacterFilter and softbodies - crash

Post by mi076 »

It is probably obsolete.. ....
i have seen the character classes had been moved from demos to
dynamics library. I shall check it first.


But here is better trace. The problem seems to happen here

btSoftBody.cpp:

switch(m_cfg.collisions&fCollision::RVSmask)
{
case fCollision::SDF_RS:
{
btSoftColliders::CollideSDF_RS docollide;
btRigidBody* prb=btRigidBody::upcast(pco);
----------> const btTransform wtr=prb->getInterpolationWorldTransform();


Here is better trace with line numbers:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1235220768 (LWP 4289)]
0x0805d7bb in btMatrix3x3 (this=0xbfef7d90, other=@0x44) at /usr/local/b_svn/bullet/src/LinearMath/btMatrix3x3.h:56
(gdb) up
#1 0x0805e026 in btTransform (this=0xbfef7d90, other=@0x44) at /usr/local/b_svn/bullet/src/LinearMath/btTransform.h:53
(gdb) up
#2 0x080aa023 in btSoftBody::defaultCollisionHandler (this=0x8932ce0, pco=0x89340a0) at /usr/local/b_svn/bullet/src/BulletSoftBody/btSoftBody.cpp:2581
(gdb) up
#3 0x080c62be in btSoftRigidCollisionAlgorithm::processCollision (this=0xb27503c8, body0=0x8932ce0, body1=0x89340a0, dispatchInfo=@0x88e75a0, resultOut=0xbfef7ec8) at /usr/local/b_svn/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp:62
(gdb) up
#4 0x080e5b33 in btCollisionDispatcher::defaultNearCallback (collisionPair=@0x89318e0, dispatcher=@0x88e9688, dispatchInfo=@0x88e75a0) at /usr/local/b_svn/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp:265
(gdb) up
#5 0x080e64e4 in btCollisionPairCallback::processOverlap (this=0xbfef7fe8, pair=@0x89318e0) at /usr/local/b_svn/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp:221
(gdb) up
#6 0x080e32ff in btHashedOverlappingPairCache::processAllOverlappingPairs (this=0x88e73b0, callback=0xbfef7fe8, dispatcher=0x88e9688) at /usr/local/b_svn/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp:383
(gdb) up
#7 0x080e5c14 in btCollisionDispatcher::dispatchAllCollisionPairs (this=0x88e9688, pairCache=0x88e73b0, dispatchInfo=@0x88e75a0, dispatcher=0x88e9688) at /usr/local/b_svn/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp:235
(gdb) up
#8 0x080e6eb7 in btCollisionWorld::performDiscreteCollisionDetection (this=0x88e7570) at /usr/local/b_svn/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp:200
/filer/local/b_svn/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp:200:6395:beg:0x80e6eb7
(gdb) up
#9 0x080d3d9e in btDiscreteDynamicsWorld::internalSingleStepSimulation (this=0x88e7570, timeStep=0.0166666675) at /usr/local/b_svn/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:390
/filer/local/b_svn/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp:390:12173:beg:0x80d3d9e
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btBroadphaseProxy::CharacterFilter and softbodies - crash

Post by Erwin Coumans »

Code: Select all

{
btSoftColliders::CollideSDF_RS docollide;
btRigidBody* prb=btRigidBody::upcast(pco);
----------> const btTransform wtr=prb->getInterpolationWorldTransform();
The bug will be fixed before Bullet 2.73 release. Basically, it is not safe to do an upcase without checking the resulting pointer: not all objects are rigid bodies.

Thanks for the report,
Erwin
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: btBroadphaseProxy::CharacterFilter and softbodies - crash

Post by mi076 »

Thank you very much for reply.
BTW, i have some other problems with actual svn revision r1492. So i switched back to 1458 -
latest published alpha release. The problem is random crashes, for example - if i wild click to shoot spheres (in F1 mode), it happens rather fast, don't know exactly. If i link the same code with r1458 it does not happen. It happens both on Linux and Windows. I shall check it again..
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btBroadphaseProxy::CharacterFilter and softbodies - crash

Post by Erwin Coumans »

The soft body against btCollisionObject/btGhostObject should be fixed now.
http://code.google.com/p/bullet/source/detail?r=1495
mi076 wrote:BTW, i have some other problems with actual svn revision r1492. So i switched back to 1458 -
latest published alpha release. The problem is random crashes
We are preparing a new Bullet 2.73 release this week, so crashes are not good.

Can you please upgrade to the latest SVN trunk, and try to reproduce the crashes in debug mode and provide a full callstack?
Thanks a lot,
Erwin
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: btBroadphaseProxy::CharacterFilter and softbodies - crash

Post by Erwin Coumans »

Please update to revision 1496, it contains a few fixes that could have caused your issue.