collision been ignored in an unpredictabble manner
Posted: Wed Dec 02, 2009 11:20 pm
Hi guys,
I have a problem with collisions, in the following scenario:
=> I have six segment shapes (lines, with ratio zero), for wich the body have infinity mass; These lines are been created like that
=> I have an object, created as a finity mass body, for which i'm attaching a circle shape, with a moment calculated by cpMomentForCircle passing the values related to the body. Both, the body and the shape are been added to the space, with cpSpaceAddBody and cpSpaceAddShape. For the line segments only the shapes are added to the space:
=> In response to the user interaction, a velocity value is applied to the body, as
Everything works nice, but in a few moments, the floating body traverse the static one as if it don't be there. The collision does not happens!!!
I placed a NSLog command to verify if this is due to a specific velocity value, but for a same value, sometimes the collision happens, sometime don't.
I have modified almost every parameter passed to the chipmunk, but unsuccessful.
I have no idea what is wrong.
Can you guys help me with this issue??
Thanks!
Dilson
I have a problem with collisions, in the following scenario:
=> I have six segment shapes (lines, with ratio zero), for wich the body have infinity mass; These lines are been created like that
Code: Select all
cpBody *bodyLine;
cpShape *shapeLine;
bodyLine = cpBodyNew(INFINITY, INFINITY);
shapeLine = cpSegmentShapeNew(bodyLine, origem, destino, 0);
shapeLine->collision_type = 0;
shapeLine->e = 1.0;
shapeLine->u = 0.2;
cpSpaceAddStaticShape(space, shapeLine);
Code: Select all
cpBody *body = cpBodyNew(m, cpMomentForCircle(100, 50, 50, cpvzero));
body->p = cpv(160, 240)
cpSpaceAddBody(space, body);
shape = cpCircleShapeNew(body, 50, cpvzero);
shape->e = 1;
shape->u = 0.8;
shape->collision_type = 1;
cpSpaceAddShape(space, shape);
Code: Select all
shape->body->v = velocity_vector;
I placed a NSLog command to verify if this is due to a specific velocity value, but for a same value, sometimes the collision happens, sometime don't.
I have modified almost every parameter passed to the chipmunk, but unsuccessful.
I have no idea what is wrong.
Can you guys help me with this issue??
Thanks!
Dilson