Probably my error, but collisions are outside shapes.
Posted: Sat Apr 13, 2013 7:55 pm
This is probably my error, but I can't find the mistake. Here's hoping someone else has encountered this.
So, collision points are retrieved from the arbiter during begin or preSolve. These points are stored within the game objects so that they can be rendered. My code isn't with me now, but it's something like:
These points are then rendered as little x's relative to their objects centre. Often times they are quite correct, lying very close to a shape's boundary. Other times, often when flat faces collide directly, collision points are wildly outside the shape. I have a test case where collision points are in error by more than twice the length of the shape.
So obviously I'm doing something horribly wrong, but I can't figure it out. There's no way that chipmunk has errors this big. My code is unavailable right now but can be posted tomorrow if necessary.
So, collision points are retrieved from the arbiter during begin or preSolve. These points are stored within the game objects so that they can be rendered. My code isn't with me now, but it's something like:
Code: Select all
for(i = 0; i < cpArbiterGetCount(arb); i++) {
aPhysicsable->storeCollisionPoint(cpBodyWorld2Local(aBody, cpArbiterGetPoint(arb, i)));
bPhysicsable->storeCollisionPoint(cpBodyWorld2Local(bBody, cpArbiterGetPoint(arb, i)));
}
So obviously I'm doing something horribly wrong, but I can't figure it out. There's no way that chipmunk has errors this big. My code is unavailable right now but can be posted tomorrow if necessary.