start falling animation

Hi, can you help me to accomplish this task:

I’m using collisionHandlerFloor to keep my model on the ground, how can I detect if it is been pushed down so that I can start its falling animation? I can’t figure it out…


I don’t believe the CollisionHandlerFloor provides this information, but you can try using CollisionHandlerGravity instead, which works similarly, and also provides the isOnGround() and getAirborneHeight() methods.


thank you drwr I will try handlerGravity,

this suddenly came out of my mind, if I create different collision meshes for the platforms in the scenario that are not in the same level, I can check if the last collision mesh, that the player’s ray hit, is not the same as the one the ray is currently hitting. If this condition is true the animation starts.

In this case I’d use handlerQueue, I’ll try this too :blush:

Well, as far as that goes, if you have a different floor surface for each different level, then you can just listen for the event that the CollisionHandlerFloor throws whenever it detects a different surface below you. It throws the same events that any CollisionHandlerEvent would through (because it in fact inherits from CollisionHandlerEvent).


I got it, good to know this, thanks!

I can’t wait to try it, see ya!

self.feetSegment = CollisionNode('feetSegment')
self.feetSegment.addSolid( CollisionSegment(0, 0, 0, 0, 0, 0.5) )
self.feetNode = self.player.attachNewNode(self.feetSegment)
self.feetColHandler = CollisionHandlerEvent()
self.colTrav.addCollider(self.feetNode, self.feetColHandler)
self.accept('into-terrain', self.__play_HitTheGround_Animation)
self.accept('outof-terrain', self.__play_Falling_Animation)

It is done!! :blush: works 100%
I couldn’t use the ray of the CollisionHandlerFloor because it extends to infinity, so it is always hitting the collision mesh. The Segment fitted well.