Character Friction

Character Friction

Is there any way to set the rate at which a hkpCharacterRigidBody will come to rest?

2 帖子 / 0 全新

Hi Drwbns,

There are a few parameters you can adjust to affect the character's stopping speed (and acceleration in general).  This is specified in each character state in the character control state machine.  For example, look at hkpCharacterStateOnGround.  This has members m_gain and m_maxLinearAcceleration, which both affect the way in which the character accelerates.  m_maxLinearAcceleration will specify how gradually the character is able to accelerate, and m_gain applies some smoothing to the character's acceleration.  Gain is always between 0 and 1 with lower values having a more dramatic effect. 

I recommend trying some different values for each to get a sense for how they work.  For example, you could run a test with a very low gain (0.01) and a very high max velocity delta (100) and observe how the character starts and stops.  Then try spamming the "walk forward' button and see how the character accelerates - he should smoothly accelerate over time to roughly 1/2 his top speed.  Then try the same test with low m_maxLinearAcceleration (1.0) and gain = 1 and see how they differ.  The former demonstrates the gain effect by itself, and the latter demonstrates the m_maxLinearAcceleration.



Josh S. Havok Developer Support Engineer