[SOLVED] CharacterControl: get Velocity? (need falling speed)

Hi,



I just made my way through the beginner tutorials and wanted to implement a very simple falling damage.



if “speed > X” at impact: damage me.



I cannot find how to get the CharacterControls velocity.



Yes I could compare the CharacterControls location with the location of the last update cycle.

But isnt there a nice way to get an objects current velocity?



Thanks in advance

-Zanval

either do the “last update cycle” thing you were on about, and then check if onGround() was false and now true



OR



(note: haven’t ever tried this but i think it would work)

use a CollisionListener and check collisions and you should be able to get a force (getAppliedImpulse() maybe?) from the collision results and if the force exerted on the ground is above a certain range then, take damage.

hey, thanks for the reply.



I know memorize the height when jumping and landing (basing on onGround)



Its enough for what I am doing atm.

I will look into CollisionListeners later on.

I’m surprised you can’t query the current velocity off the physics object?

@zarch said:
I'm surprised you can't query the current velocity off the physics object?

Its because its a character and hence has no physics.

But something must know how fast it’s falling? Or does character always fall at a fixed rate? In which case the question becomes moot…and changes to knowing how far something has fallen, not how fast it’s falling at impact.

Yeah, as soon as theres no contact it starts to fall up to a max fall speed.

But there is no way to query the current fall speed? How hard would it be to add a getter for it?

I don’t know, ask erwin. I’m reluctant to add anything beyond whats there while we have the jbullet/bullet situation.