Search code examples
bulletphysicsbullet

Bullet - Rigid bodies not colliding at high speed?


I'm trying to make a basic first person shooter game with Bullet and OpenGL. I'm having the issue of my rigid bodies not colliding at high speed.

My bullets will go straight through any other rigid bodies that I have, such as walls. Reducing velocity to less than 10 does result in collisions, but this is too low for a moving bullet. The bullet also moves insanely fast (I know it's a fast moving bullet, but sometimes I can't even see it, not sure if that's expected).

I'm thinking that it's to do with how I'm stepping the simulation? Reading up on it has left me confused. How can I make it so that my objects will always collide (at least, when going reasonably fast), and if possible, is there a way to slow the simulation down whilst maintaining the correct bullet velocity etc. so that I can actually see the bullet moving and colliding?


Solution

  • Here are some approaches to solve:-
    It is copied from How can I avoid missing collisions for fast moving objects? - an official FAQ

    • smaller timesteps
    • extruding the object along the motion
    • ray cast to the new position
    • swept collision test (convex cast, linear cast)
    • continuous collision detection, including rotational motion

    Please read the link for more detail. It is not a trivial issue.
    One important thing to ask before try anything: do you really need high speed object?
    It is not free (cost more CPU).

    Here is another useful link (less useful though) : https://gamedev.stackexchange.com/questions/11961/how-can-i-enable-ccd-in-bullet-physics