Detect falling body

Official forum for the Chipmunk2D Physics Library.
Post Reply
ganesha
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm
Contact:

Detect falling body

Post 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.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Detect falling body

Post 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
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests