views:

39

answers:

0

I have a body which I move with the help of a button,here is what Im doing

-(void) step: (ccTime) delta { int steps = 2; CGFloat dt = delta/(CGFloat)steps;

for(int i=0; iactiveShapes, &eachShape, nil); cpSpaceHashEach(space->staticShapes, &eachShape, nil);

if(MoveBody)
{

cpFloat movementPadding = 0.1; cpBodyApplyForce(body, cpvmult(ccp( 10, 0), movementPadding), cpvzero);
} else cpBodyResetForces(body); }

I just want to stop the body moving whenever the condition fails,I am trying to reset all forces to 0 with cpBodyResetForces(body),but this never work,it just keep on moving.

can anyone help me how can I stop the body moving?