Closed AndyZe closed 1 year ago
I worked around this by using the lower-level API of std::unique_ptr<btCollisionDispatcher> dispatcher_
. That's good enough for my purposes. I don't even use btCollisionWorld or btDiscreteDynamicWorld. I used the MoveIt implementation as an example:
I've found this issue can be caused by passing a pointer to a local variable, like this. This is bad:
{
btTransform tf;
tf.setIdentity();
tf.setOrigin(btVector3(1e5, 1e5, 1e5));
bed_collision_object_->setWorldTransform(tf);
btSphereShape sphere_shape(btScalar(0.1)); // Goes out of scope
bed_collision_object_->setCollisionShape(&sphere_shape);
addCollisionObjectToBroadphase(sphere_collision_object_, broadphase_, dispatcher_);
}
Fixed version:
btSphereShape sphere_shape(btScalar(0.1));
{
btTransform tf;
tf.setIdentity();
tf.setOrigin(btVector3(1e5, 1e5, 1e5));
bed_collision_object_->setWorldTransform(tf);
bed_collision_object_->setCollisionShape(&sphere_shape);
addCollisionObjectToBroadphase(sphere_collision_object_, broadphase_, dispatcher_);
}
So this was probably user error. Closing.
I'm having a "Pure virtual function" issue with a basic collision detection app in Linux (ubuntu 20.04).
I can set up the btDiscreteDynamicsWorld just fine and the project compiles. I can print the object locations. But at runtime, this line:
collision_dynamics_world_->performDiscreteCollisionDetection();
gives "pure virtual method called. terminate called without an active exception".
Here are the relevant bits from my CMakeLists. Basically I tried anything possible to link against all Bullet libraries:
I printed ${BULLET_LIBRARIES and ${BULLET_INCLUDE_DIRS} and these are the results:
BULLET_INCLUDE_DIRS="/usr/include/bullet" BULLET_LIBRARIES="/usr/lib/x86_64-linux-gnu/libBulletDynamics.so/usr/lib/x86_64-linux-gnu/libBulletCollision.so/usr/lib/x86_64-linux-gnu/libLinearMath.so/usr/lib/x86_64-linux-gnu/libBulletSoftBody.so"