Page 1 of 1
cpBodyResetForces
Posted: Tue Aug 10, 2010 1:52 pm
by badgerr
I'm trying to reset the forces applied to a body, but calling this function doesn't seem to do it, as the forces are still present after this call. Is there anything I'm missing? I've looked through all the documentation and searched these forums and I've not found any specific information or cases of it not working for others.
Cheers
Re: cpBodyResetForces
Posted: Tue Aug 10, 2010 4:58 pm
by slembcke
The function is trivially simple. I'm not sure how it could go wrong exactly. Try setting a breakpoint in the debugger for cpBodyResetForces(). Maybe you are just resetting the forces on the wrong body?
Re: cpBodyResetForces
Posted: Wed Aug 11, 2010 6:20 am
by pat
badgerr wrote:I'm trying to reset the forces applied to a body, but calling this function doesn't seem to do it, as the forces are still present after this call. Is there anything I'm missing? I've looked through all the documentation and searched these forums and I've not found any specific information or cases of it not working for others.
Cheers
Not sure if this is the problem, but if your trying to stop the object. you need to call cpBodyResetVelocity too.
Re: cpBodyResetForces
Posted: Wed Aug 11, 2010 8:54 am
by slembcke
pat wrote:Not sure if this is the problem, but if your trying to stop the object. you need to call cpBodyResetVelocity too.
Never heard of cpBodyResetVelocity(), are you using a wrapper or something? Presumably such a thing would just do: body->v = cpvzero; body->w = 0.0f;
Re: cpBodyResetForces
Posted: Wed Aug 11, 2010 8:35 pm
by pat
er, oops. Nah i'm not using a wrapper i was just wrong. I was using cpBodySetVel(body, cpvzero)
Re: cpBodyResetForces
Posted: Thu Aug 12, 2010 12:34 pm
by badgerr
cpBodySetVel did the trick. Thanks.