Collision response between a character and a vehicle

ipil
Posts: 2
Joined: Fri Aug 14, 2009 7:05 pm

Collision response between a character and a vehicle

Post by ipil »

Hi, i'm new to bullet and i am trying to handle collisions between a kinematic rigid body, the character, and vehicles (set up using btRaycastVehicle etc). As soon as the objects collide the vehicle is flying up into the air. Is there any reliable way to just turn the character into a dynamic body (for a while) when they collide. I'd like the vehicle to just keep going, and let the character do all the flying so to speak.

I've tried implementing and using some of the collision filtering from the manual, but the results so far are not very convincing nor reliable..

Perhaps using a character controller somehow is the way to go, I haven't tried that yet.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Collision response between a character and a vehicle

Post by sparkprime »

So character and some other object is kinematic and the vehicle is not? In which case the vehicle has to give.
ipil
Posts: 2
Joined: Fri Aug 14, 2009 7:05 pm

Re: Collision response between a character and a vehicle

Post by ipil »

I think i have something that seems to work quite well. I create two rigid bodies for the character, one kinematic (added to the world) with mass = 0 and collision flags = CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE, and one dynamic (by default not added to the world) with mass >= 1. when the objects collide i replace the kinematic body with the dynamic and i get the response i want, i.e. the vehicle isn't affected and the character is pushed away.