lunkhound wrote: ↑Sun Apr 15, 2018 8:40 pm
Note that my pull-request for the multithreaded constraint solver has been accepted and merged (a couple of weeks ago). So this is now available in the main Bullet repo.
Thanks for sharing your code.
1. My program using single-threaded btDiscreteDynamicsWorld crashed because of btSequentialImpulseConstraintSolver::getOrInitSolverBody method returned -1
It happened because of line:
Code: Select all
if ( btRigidBody* rb = btRigidBody::upcast( &body ) )
I use CollisionObjects aside from RigidBodies. After I commented line above, single-threaded simulation started to work again.
Similar line is in btSequentialImpulseConstraintSolverMt::getOrInitSolverBodyThreadsafe though.
2. After configuring btDiscreteDynamicsWorldMt with specified btSequentialImpulseConstraintSolverMt program crashes as well.
For btDiscreteDynamicsWorldMt without btSequentialImpulseConstraintSolverMt it works.
I guess (like in the case above) it may have problems when there are pure CollisionObjects inside dynamic world aside from RigidBodies.
To reproduce problem with a small amount of code, I modified your sample (MultiThreadedDemo) a bit, i.e replaced fragment of method MultiThreadedDemo::createStack
from:
Code: Select all
btRigidBody* body = localCreateRigidBody( mass, trans, boxShape );
body->setFriction( 1.0f );
body->setRollingFriction( gSliderRollingFriction );
to:
Code: Select all
if(iX % 2 == 0) {
btRigidBody* body = localCreateRigidBody( mass, trans, boxShape );
body->setFriction( 1.0f );
body->setRollingFriction( gSliderRollingFriction );
}
else {
btCollisionObject* collisionObject = new btCollisionObject();
collisionObject->setWorldTransform(trans);
collisionObject->setCollisionShape(boxShape);
m_dynamicsWorld->addCollisionObject(collisionObject);
}
Now it causes crash.