Page 1 of 1

Detect falling body

Posted: Mon Oct 13, 2014 1:38 pm
by ganesha
I have a question that perhaps is very simple. How do I detect that a body is falling?

Scenario: a character is falling from a platform and the body language needs to be adapted during the fall and restored as soon as the floor is hit.

Re: Detect falling body

Posted: Fri Oct 17, 2014 6:50 pm
by slembcke
The easiest thing to do is just to check if you body is touching the ground or not. cpBodyEachArbiter() is the easiest way to do that. The "Contact Graph" demo does something pretty close:
https://github.com/slembcke/Chipmunk2D/ ... aph.c#L104