Collision not detected sometimes

dilsonalkmim
Posts: 2
Joined: Thu Apr 25, 2013 4:35 pm

Collision not detected sometimes

Post by dilsonalkmim »

Hello all,

I'm new to bullet, and I'm trying to build a simple game that has some colliding balls.
I'm setting the world this way:

Code: Select all

    //
    btBroadphaseInterface* broadphase = new btDbvtBroadphase();
	
    // Set up the collision configuration and dispatcher
    btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
    btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
	
    // The actual physics solver
    btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
	
    // The world.
    _world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
    _world->setGravity(btVector3(0, 0, -kGravity));
There are some boudaries that are beeing added as btConvexHullShape instances and the ground as btStaticPlaneShape.

Sometimes the ball cross through the boundaries, sometimes not. Sometimes one ball cross through the other, sometimes not.
I notices that the most of time the collisions don't happen at high speed impact.
I tried using a fixed very low timestep, calling the stepSimulation method of _word severaltimes instead of calling only once, but it didn't work.

Can you help me with this issue?
Any hint I can follow in order to solve this problem?

Thank you very much!
Zaoshi
Posts: 3
Joined: Thu Apr 25, 2013 7:07 pm

Re: Collision not detected sometimes

Post by Zaoshi »

Balls are moving too fast causing them to 'miss'. You could lower speed, decrease timestep or using continuous collision, however I'm not sure if Bullet has continuous physics.
MaxDZ8
Posts: 149
Joined: Fri Jun 24, 2011 8:53 am

Re: Collision not detected sometimes

Post by MaxDZ8 »

Yes, Bullet has continuous physics. It can be enabled on a per-object basis and happens to run only when a certain speed threshold is exceeded. See CCDPhysicsDemo. It basically allows you to shoot a high-speed bullet at a wall of cylinders. The speed is so massive the chance to miss is close to 100% yet it works perfectly with CCD.