Angular velocity limit not applied in cpBodyApplyImpulse
Posted: Sun Aug 22, 2010 9:59 am
Hello,
I noticed that the angular velocity limit of cpBody (w_limit) is only applied in cpBodyUpdateVelocity but not in cpBodyApplyImpulse. I did a small patch:
Seems to fix the issue for me, but there might be something that I've missed (i.e. perhaps it should not be applied here for other reasons?).
Thanks a lot for creating a very useful library!
I noticed that the angular velocity limit of cpBody (w_limit) is only applied in cpBodyUpdateVelocity but not in cpBodyApplyImpulse. I did a small patch:
Code: Select all
static inline void
cpBodyApplyImpulse(cpBody *body, cpVect j, cpVect r)
{
cpFloat w_limit = body->w_limit;
body->v = cpvadd(body->v, cpvmult(j, body->m_inv));
body->w = cpfclamp(body->w + body->i_inv*cpvcross(r, j), -w_limit, w_limit);
}
Thanks a lot for creating a very useful library!