Gravity in Panda3D

Hello. Can someone tell me how to apply gravity to a first-person-controller camera?
Do I need to do something like add a CollisionHandlerFloor and chek the collision if it is touching the ground, or is there anything easier.

You can use CollisionHandlerGravity or you can use CollisionHandlerQueue with a manual check of whether the object is touching the ground. The latter method is more common.

In the latter case, gravity is simply a matter of applying a downward acceleration to your object.

So for example, if you use a velocity-vector to move your object then, on each frame, you would add something like -9.8*deltaTime to the z-value of your velocity (presumably with a terminal velocity applied to prevent the value from becoming too huge).

Furthermore, depending on your implementation, it may be wise to apply gravity only when the object is known to be above the ground. This may prevent the effect of gravity from “fighting” with the code that keeps your character on the ground.

The manuals don’t have any information on the CollisionHandlerGravity class. So how do you use one?