c++bulletphysicsbullet

Platformer game - Avoid collision with platform when getting down


I'm using BulletPhysics in C++.

I would like to know if there is a way to avoid collision for an object when I want?

I'm trying to create a platformer and I want my character to be able to pass through a platform (by holding down the down button). I've thought about using ray cast to manage its position but it doesn't seems for me to be a good way; it would be better if I could access the physics response and choose whether or not to apply it to my object, but I don't know if this is possible.

(If you have a solution without code it's ok for me, I'm just making some research, I haven't started development).

Thank you in advance.


Solution

  • I found a solution to my problem.

    To be able to cross a platform (by holding down the down button), you have to know if the character is on a platform. To do this, you have to put a box (which listens to all object that collide with it) and if it collides with a platform, get a pointer of the platform and call the method void setIgnoreCollisionCheck btCollisionObject * co, bool ignoreCollisionCheck) on the character's btCollisionObject.