Request for comments on Character Simulation

zweifel
Posts: 6
Joined: Wed Oct 13, 2010 3:25 pm

Request for comments on Character Simulation

Post by zweifel »

Hi Guys,

I use a simple approach to simulate the character in the bullet library instead of using the character controller provided by bullet. My approach is briefly described below

Code: Select all

- Add a capsule
- setAngularFactor(0.0);
- insert in the world

//Loop
linear_velocity= character_velocity + bullet_physics_velocity*weight
setLinearVelocity(linear_velocity)

Everything went as planned and the character mixed the physical with the animation. But after some testing I noticed that the character starts to fall on inclined terrain no matter what weight.

Solutions:

1- The logical solution at first glance was to set the friction of both the character and the terrain to some high number (m_friction). But after some value, the character cannot climb the terrain anymore and below this same value the character slides through it. I also read somewhere that since my shape is a capsule the contact would be a single point which makes the friction useless. Is there a known workaround?

2- After reading a bit of documentation, I found out that I have to use a tick callback to be sure that the velocity of the character is updated every tick of the Physics Engine. Source: http://bulletphysics.org/mediawiki-1.5. ... e_Snippets
That however would not solve the problem, because the velocity I want to stop is the one caused by the inclined terrain and not the one caused by the collision with characters and other objects. Then, I would have to check for collision as well and this can be a complex and error prone solution.

3- Stop setting up the velocity and passing to bullet and instead decide outside of the bullet the new character's position and update it to bullet by setting the new center of mass. However in this case I would lose much of the nice simulation done by bullet physics (I myself do not like this approach).

Please, tell me what you think. Any comment is widely appreciated.