- #1
Crashgate3
- 1
- 0
I'm writing a little 2D physics engine. The collision response is calculated by working out the impulse (and so, change in momentum) on each object, and takes into account the objects' velocities, angular velocities, and the fact that the collision normal may be in a different direction to the relative velocities of the contact points on each object. I've got the impulse working fine for a frictionless collision - my objects seem to behave themselves when I set things running, but I'm having real trouble establishing how friction affects things - for example two spinning balls colliding, where the coefficient of friction will affect how much spin is transferred between the balls.
I'm working from David M Bourg's 'Physics For Game Developers' - Bourg states that the impulse, which in a frictionless collision is in the direction of the collision normal, gets an additional component added in the direction tangent to the normal, of magnitude equal to the coefficient of friction * impulse.
This seems wrong to me (and indeed, when I add this to my code, gives the wrong behaviour) - it doesn't seem to include the relative velocities of the two collision points in the direction of the collision tangent - even if the relative velocity along this tangent is zero, as in the case of two non-rotating spheres colliding, it would still add a sideways impulse which is clearly wrong.
Can anyone direct me any further?
I'm working from David M Bourg's 'Physics For Game Developers' - Bourg states that the impulse, which in a frictionless collision is in the direction of the collision normal, gets an additional component added in the direction tangent to the normal, of magnitude equal to the coefficient of friction * impulse.
This seems wrong to me (and indeed, when I add this to my code, gives the wrong behaviour) - it doesn't seem to include the relative velocities of the two collision points in the direction of the collision tangent - even if the relative velocity along this tangent is zero, as in the case of two non-rotating spheres colliding, it would still add a sideways impulse which is clearly wrong.
Can anyone direct me any further?