2d game friction problem

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
skinnny
Posts: 2
Joined: Fri Nov 30, 2012 3:14 pm

2d game friction problem

Post by skinnny »

Hi all

I'm writing a game which requires some physics simulation and I'm struggling to figure out how to do it.

I'll describe a simplified version of what I need.

* 2 dimensions (x - horizontal, y - vertical).
* +ve x direction is left to right.
* +ve y direction is bottom to top.
* +ve rotation direction is anti-clockwise.
* No gravity.
* A circle C (radius r) that has mass m and can only rotate (with angular velocity w)...ie cannot move linearly.
* An infinite horizontal plane P1 above the circle, pressing down on it with force F1, moving horiztonally with constant velocity V1.
* An infinite horizontal plane P2 below the circle, pressing up on it with force F2, moving horiztonally with constant velocity V2.
* Both planes are massless (or infinitely massive...whatever...basically not affected by forces, etc).
* The contacts between the planes and the circle have friction coefficient u.

So given the above situation, at every time step (size t), I want to calculate the applied friction forces at each contact.

I know that the friction force is generally u * N (or u * Fn, in my example), but the problems comes when u * N causes a change in direction of the relative velocity at the contact point....when it should at most zero the relative velocity.

I usually handle this (in simpler examples) by finding an equation for the resultant relative velocity after applying forces, setting that to zero and solving for the forces (ie finding the forces that would zero the relative velocities), then clamping the resultant forces to maximum values as determined by the friction coefficients and normal forces.

But I can't do that in this case because there may well be no solution for the relative velocity equations both being zero (in fact there would only be a solution if V1 == -V2).

These are the equations I have so far:

linear velocity of C at contact point with P1, vc1 = -r * w
linear velocity of C at contact point with P2, vc2 = r * w
moment of inertia of C, I = m * r * r
next frame angular velocity of C, w' = w + (r * F1 * t1)/I + (r * F2 * t2)/I

I suspect I should be working with impulses rather than forces, but that seems like a trivial matter.

From those equations I can get the equations for the next frame's relative velocities due to applied forces, but I'm not sure that's the correct approach any more.

Can anyone give me a clue regarding how to proceed with this?

To be clear, at this stage, I'm only interested in formulating the equations that need to be solved...not the actual solving of them.

Thanks in advance!
skinnny
Posts: 2
Joined: Fri Nov 30, 2012 3:14 pm

Re: 2d game friction problem

Post by skinnny »

I suppose more generally this is about multple friction forces acting on a body.
My method for calculating one friction force was to calculate the force necessary for the body to reach equilibrium (ie zero forces applied, ie zero relative contact velocity) and clamp that force to the max friction force.
My problem with multiple friction forces and this method is that I don't know what the equilibrium point is when there can never be all zero relative contact velocities.
Is my method just wrong?
Sorry if this is all too incoherent.
Post Reply