cpBodyResetForces

Official forum for the Chipmunk2D Physics Library.
Post Reply
badgerr
Posts: 2
Joined: Tue Aug 10, 2010 1:50 pm
Contact:

cpBodyResetForces

Post 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
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: cpBodyResetForces

Post 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?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
pat
Posts: 53
Joined: Tue Jul 20, 2010 7:55 pm
Contact:

Re: cpBodyResetForces

Post 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.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: cpBodyResetForces

Post 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;
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
pat
Posts: 53
Joined: Tue Jul 20, 2010 7:55 pm
Contact:

Re: cpBodyResetForces

Post by pat »

er, oops. Nah i'm not using a wrapper i was just wrong. I was using cpBodySetVel(body, cpvzero)
badgerr
Posts: 2
Joined: Tue Aug 10, 2010 1:50 pm
Contact:

Re: cpBodyResetForces

Post by badgerr »

cpBodySetVel did the trick. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests