point detect in body

Official forum for the Chipmunk2D Physics Library.

point detect in body

Postby ideath » Wed Jan 14, 2015 4:53 am

Hello is there way to detect that point with coordinates (x,y) inside a body?
I'm using chipmunk with cocos2d js
ideath
 
Posts: 3
Joined: Sat Jan 10, 2015 6:28 am

Re: point detect in body

Postby aisman » Wed Jan 14, 2015 7:47 am

Look on Demo file:
ChipmunkDemo.c =>
Code: Select all
static void
Tick(double dt)
Code: Select all
static void
Click(int button, int state)

I belive it is this one:
Code: Select all
cpVect new_point = cpvlerp(mouse_body->p, ChipmunkDemoMouse, 0.25f);
Chipmunk4PB: The fastest way to write games together with PureBasic and the Chipmunk physics engine.
User avatar
aisman
 
Posts: 143
Joined: Tue Mar 04, 2008 2:21 am

Re: point detect in body

Postby ideath » Thu Jan 15, 2015 7:52 am

ty for help but i found a solution in using "space.nearestPointQueryNearest" method.
but now i have another problem, how can i find distance between 2 shapes?
ideath
 
Posts: 3
Joined: Sat Jan 10, 2015 6:28 am


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: Heise IT-Markt [Crawler] and 1 guest

cron