Calculate distance between two bodies

Official forum for the Chipmunk2D Physics Library.
Post Reply
FelipeTavares
Posts: 2
Joined: Sat Jul 28, 2012 8:32 pm
Location: On the front of a PC
Contact:

Calculate distance between two bodies

Post by FelipeTavares »

Is there any way to fast calculate the distance between the centre of two bodies ? If yes, how can I do this?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Calculate distance between two bodies

Post by slembcke »

You can get the center of a body using cpBodyGetPosition(), and calculate the distance between two points using cpvdist().
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
FelipeTavares
Posts: 2
Joined: Sat Jul 28, 2012 8:32 pm
Location: On the front of a PC
Contact:

Re: Calculate distance between two bodies

Post by FelipeTavares »

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests