Wondering Of Character Proxy Behavior

Wondering Of Character Proxy Behavior

Hi all.

I have some trouble with hkpCharacterProxy.

First of all, character changes its state(from on_ground to in_air),

even though I want character stay on 'on_ground' state.

If I add a character proxy to hkpWorld with 'ON_GROUND' state and update character several times,

chacter changes its state as follows.

(on_ground -> in_air -> on_ground)

I added a character at (0,0,0) after adding a plane rigidbody at (0,0,0).

I wonder why character changes its state.

Please let me know why it changes its state or how can I set a character to remain its state.

Second, character proxy does not move as I expected.

I added a character at (0,0,0) and set hkpCharacterInput as (m_inputUD = 1 and m_velocity = (0,0,1))

and ((hkpCharacterStateOnGround*)state)->setSpeed(1)

and update(including checkSupport, contextUpdate, setLinearVelocity, integrate) 20 times.

I expected that a character would be at (0,0,20), but it's at (0, 0, 19.738..).

The code that I used as follows.

m_input->m_velocity = m_characterProxy->getLinearVelocity();
m_input->m_position = m_characterProxy->getPosition();
m_characterProxy->checkSupport(*DownVector, m_input->m_surfaceInfo);
// Apply the character state machine
	HK_TIMER_BEGIN("update character state", HK_NULL);
	m_characterContext->update(*m_input, *m_output);
//Apply the player character controller
	HK_TIMER_BEGIN("simulate character", HK_NULL);
	m_characterProxy->integrate(*m_stepInfo, m_input->m_characterGravity);


* Anything that is not shown here is similar with demo code.

Third, is character proxy's max speed 20m/s?

When I did unit test a character proxy with speed over 20m/s, it did not move with speed over 20m/s.

Any helps will be appreciated.


- Jinkwang

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

Hi Jinkwang,

I'm not sure why your character proxy is flipping between states, could you send a visual debugger recording of the problem. Check out the docs under 'Havok Physics > Using the Visual Debugger > Preparing a Visual Debugger movie for a support query' for more info on how to do this.

As for the position problem, what values are you using for friction on the character proxy? It could be that friction is slowing it down and not reaching the exact place you'd expect.

For the max speed, are you using the state machine set up we have? If so, we do a lot of velocity modification, check out each state and also the hkpCharacterContext::update(). I'd try measuring m_output->m_velocity to see if it's what you expect before calling m_characterProxy->setLinearVelocity().

Let me know if you have any more questions!


Pete Developer Support Engineer Havok www.havok.com

Hi, Pete. Thank you for your responding.

1. VDB Movie

I attatched the recorded file("state changes.zip").

2. I use default friction.

3. Yes. I used default character state and statemachine that is in havok library

BTW, I'v done a test onStairClimbingDemo.

Ichanged some valueson StairClimbingDemo.cpp.

Pseudocode isas follows.

hkpCharacterInput input;

hkpCharacterOutput output;

intput.m_velocity.set(30, 0, 0); // I forcely set this velocity for test

checkSupport(); // after this -> supportedState = Supported

characterProxy.update(input, output); // after this -> output.velocity = 20.0f 

The result was as follows.

If I set the input velocity to 999, output velocitycame to989... and input 100 then output would 90.

The outputseemed to be subtracted 10 from input. (output velocity = input velocity - 10)

I know thereis a threshold for the velocity of character proxy.

If I can know what affects the output velocity, that'll be a great help for me.

I mean which value that I have to manage.

I thank you very much again.

Have a nice weekend.


- JK


Download state_changes.zip860.76 KB

Hi jinkwang.choi,

That hkpCharacterContext::update() function is a sort of 'user level' velocity modification, meaning it's up to you whether you want to call it or not. Among other things, it does some smoothing the velocity. As a quick check, you might try just not calling that function, and see if that will work out for your purposes.

Let me know how it goes!

Pete Developer Support Engineer Havok www.havok.com

Login to leave a comment.