Improving my Character Controller

Nomar
Posts: 4
Joined: Fri Dec 31, 2010 10:16 am

Improving my Character Controller

Post by Nomar »

Hi!

I am developing a game that uses Bullet for physics, and I am implementing my own character controller. By the moment, i have 2 options, but I am not sure about wich one to choose:

1) As in the Character Controller demo, i represent the character with a ghostObject, to fast detect collisions. It's currently implemented and working as expected.

2) Alternativelly, I have a Kinematic rigid body (mass = 0) with a synchronized ghostObject that shares the same shape, to fast detect collisions. It's just an idea, not yet implemented

The problem is that in a near future, I will need that my character react to explosions and projectiles. So this is why I am wondering if I should implement the alternative 2, the idea would be as follows:

When I detect that the explosion/projectile affects to my character, I give him a mass != 0 (becoming in theory, a Dynamic Body), I apply the corresponding force with its direction and module and Bullet does the hard work for me to calculate the position of the character every step of the simulation. When the reaction to explosion ends, I set mass = 0 (becoming a Kinematic body again) recovering the control of the character.

Is this the right way to get what I want? Or there is a better way to do so?

Thanks!
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Improving my Character Controller

Post by sparkprime »

I am wondering if a box (for example) would react differently if it found itself intersecting with a static object vs a dynamic object. Would it receive more impulse from the static object?