CharacterControl collision force

Hello,
I’m trying to create a life bar for my game.
I’ve got a characterControl and a terrain.
I can detect collisions beetwen both of them but I can’t get the “force”.

By force I mean, for exemple, if the player jumps from a height called X he the force returns Y and if he jumps from X + 10 the force returns Z (and Z > Y).

I don’t really know if you understand this, I did my best.

Thank you.

Maybe you could compute movement quantity ? Q = m * V
This can be similar to F = m * A, with A the unit absorption of all speed…(A = -V * 1)

If you are only interested in the strength, if rbc is your RigidBodyControl, you could have F = rbc.getMass() * rbc.getLinearVelocity().length()

Ok thanks. But I don’t use a RigidBodyControl, I use a CharacterControl. So is it still possible to use your solution ?

Do you know any way to an indicator which would give me the strenght of the fall ?

If you can get the linear speed, this is not different. Never played with this one.
The mass of your character is most certainly constant. So you can put in any constant factor you wish… Only speed counts.

----- Out of subject Warning -------

Just received this message :

ERROR: Slow down; you move too fast.

ERROR: Duplicate reply detected; it looks as though you’ve already said that!

Nice touch of you devs ! Just clicked twice on the submit button, cause it’s too late for my fingers…

----- / Out of subject Warning -------

Ok I tried to find something with the speed but the CharacterControl object doesn’t have any method which returns a speed :-/

Well speed = distance / time (m/s)

So store the previous frame Y location, subtract that from the current when you hit the floor, divide by tpf, and you have the velocity in the Y direction

Ho yep didn"t realise it was possible to do that :stuck_out_tongue:

Thank you very much !

Hum… This implies storing the position during the pre-tick to compute the difference after the physical tick. Not nice.

The control must have some speed. Otherwise it would not fall… But maybe it’s not reachable for you ? (I don’t use this control)