CharacterRigidBody Issue

CharacterRigidBody Issue

Hi,

I'm making a First-Person shooter and am using hkpCharacterRigidBody for the controls. I have one small issue though, I've noticed the problem in the demos as well. The issue I'm facing is that when walking off a ledge, the body seems to lose contact when the slope degree is to large, and when this happens it will start falling and then hit the edge, thus slowing down and slightly bouncing off the edge. Although this might not be as big of a problem in 3rd person, it becomes very noticeable in first person. I've tried using other shapes and changing the slopeDegree. I also tried lowering the radius of the capsule. But it either resulted in the body not being able to traverse small, but sharp bumps or it being too close to a wall.

There were no problems that I could notice with hkpCharacterProxy, but I'd much rather use rigid bodies as far as I can.

Thanks for the help
Rasmus

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Rasmus,

If I understand correctly your character is walking down a ledge and when taking the step it starts flying instead of just going down the step, is that correct?

This is a well known problem and solving this in general is not possible. Usually it must be tweaked on a case-by-case basis until the desired behavior is obtained.

If you look at Demo\Demos\Physics2012\UseCase\CharacterControl\CharacterRigidBody\StairClimbingRb\StairClimbingRbDemo.cpp you'll see that in this specific case we are using a capsule (and I recommend you stick to that shape for the Character RB since it has some special unwelding code to prevent other issues). Depending on the size of the steps, the character will sometime enter in flying state.

Common approaches to fix the issue:
* Tweak the character gravity in hkpCharacterInput::m_characterGravity, in the demo we are using 16.0 instead of 9.8 for example so that it will land fast.
* Reduce the size of the steps and make sure that the character doesn't fly for a long time. Maybe even delay the "flying" animation if you have one until the character has been flying for some time (so that if it enters the flying state for a split-second while going downstairs it's still fine).
* Increasing the capsule radious could help a bit (not reducing it).
* Replace the ledge or stairs mesh with a simple ramp for the Physics simulation. The graphics mesh can still be stairs, and that can still be used for character foot IK (if you have it in your project), but this way the character won't enter in flying state while going down stairs.

Let me know if this helps!

Cheers,
Daniele

Try not to become a man of success, but rather try to become a man of value.

Leave a Comment

Please sign in to add a comment. Not a member? Join today