Page 1 of 1

point detect in body

Posted: Wed Jan 14, 2015 4:53 am
by ideath
Hello is there way to detect that point with coordinates (x,y) inside a body?
I'm using chipmunk with cocos2d js

Re: point detect in body

Posted: Wed Jan 14, 2015 7:47 am
by aisman
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);

Re: point detect in body

Posted: Thu Jan 15, 2015 7:52 am
by ideath
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?