Slow mesh collision tests?

Post Reply
jimbob
Posts: 1
Joined: Tue Apr 23, 2013 3:46 am

Slow mesh collision tests?

Post by jimbob »

A friend and I recently started working on a video game using bullet physics. In our character controller, we use btDisreteDynamicsWord#convexSweepTest with a ClosestConvexResultCallback to detect collisions with the rest of the world. This works really well when the objects in our world are all boxes. But when we try to include more complex collision shapes, collision testing slows down to the point of making the game unplayable.

For a bit of background, our character's collision shape is a cylinder and it's colliding with an icosphere (80 faces) exported from Blender, then imported using the BulletWorldImporter. When we use a convex hull as the collision shape, collision detection is very fast. But if we try to use a trimesh, collision detection is very slow, even when the object is static. As long as the character is not near the icosphere, collision detection is very fast. But as soon as the character is next/touching the icosphere, collision testing becomes extremely slow.

It seems like we must be doing something wrong. I obviously expect collision detection to be slower with a trimesh, but not to this extent. Is there some other way we should be doing collision detection? Or perhaps the blender export is creating a trimesh with a huge number of faces? Thanks for any help - we're both new to bullet.
Post Reply