I am trying to implement a simple collision capsule so my animated character will be able to physically walk on the ground, bump into walls, etc.
My original approach was the following:
1. The character is positioned and animated relative to a root transform R.
2. Let the position of the capsule, P0 be either explicitly defined by the animation (via keyframes), or computed from the characters position.
3. Execute the bullet simulation step to derive the corrected capsule position, P1
4. Multiply R by Delta(P0, P1 ) to correct the position and shift the character.
Or in plain English... determine where you expect the collision capsule to be from the animation, determine where the capsule ends up (after forces, and collision resolution), and shift the character's location accordingly.
A problem arose with 2, because I found that Bullet does not easily let you just re-position a rigid body in this manner. I would have to remove and re-add the body to the simulation for this to work and i'm worried that this will be an issue with speed and stability. I don't think Bullet is meant to be used in this way.
A potential solution is to set the capsule's velocity equal to Delta(P0, P1 ) at every frame (I like this idea because then it gives the capsule the appropriate momentum and it would realistically knock another lose object around if you ran into it). But then the problem becomes friction. If I set the friction to 0, the capsule will slide everywhere and not grip the surface. But if I use non-zero friction, then the shift will be dampened and not correct.
Am I using an outlandish approach for this? Can anyone suggest a better way?