Detect falling body

Official forum for the Chipmunk2D Physics Library.

Detect falling body

Postby ganesha » Mon Oct 13, 2014 1:38 pm

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.
ganesha
 
Posts: 71
Joined: Mon Sep 06, 2010 1:29 pm

Re: Detect falling body

Postby slembcke » Fri Oct 17, 2014 6:50 pm

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/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest