Access violation when deleting bodies
Posted: Fri Jul 17, 2015 9:13 pm
I am trying to delete a body using the same code as the collision example but I am getting an access violation error on the last line when calling cpBodyFree(). Anyone know whats up?
cpSpaceRemoveShape(space, shape);
cpSpaceRemoveBody(space, cpShapeGetBody(shape));
cpShapeFree(shape);
cpBodyFree(cpShapeGetBody(shape));
cpSpaceRemoveShape(space, shape);
cpSpaceRemoveBody(space, cpShapeGetBody(shape));
cpShapeFree(shape);
cpBodyFree(cpShapeGetBody(shape));