Dirk Gregorius wrote:
Regarding friction:
I apply the friction at the manifold center as we discussed a while ago
. And of course I have all normal impulses then. What I don't see is the problem with wild impulses. I compulte the friction using the accumulated impulse, not the intermediate "Delta Impulses"....
With regards to applying the friction at the manifold center - I'm actually experimenting with the same thing. My approach is as follows:
Before the solver loop I:
1) Compute the friction information by taking the average of the position, normal, and accumulated normal (impulse) force of all the contacts from the previous frame. eg. for a cube lying on a plane, this will be the center of the 4 contact points, with normal pointing upwards. From this I have "FrictionPoint", "FrictionNormal" and "NormalForce"
2) Compute the relative velocity of FrictionPoint. From this I can compute the velocity into the collision plane (FrictionNormal) and along the collision plane (I call this the FrictionDirection). If the FrictionPoint is not moving I use the previous frames FrictionDirection
3) Compute the impulse at FrictionPoint required to stop the FrictionPoint moving along the FrictionDirection. I call this impulse the FrictionForce
4) I then use the NormalForce information from 1) so I can compute the friction limits. In the case that contacts have just been added (no normal impulse force info available from the previous frame) and NormalForce=0, I compute the appropriate normal impulse force at the friction point to stop movement (or bounce etc) into the collision plane and assign it to NormalForce.
5) So with the approx FrictionForce and NormalForce available, I can then decide on what friction limits to use like so:
MaxStaticForce = MaterialStaticFriction * NormalForce
MaxDynamicForce = MaterialDynamicFriction * NormalForce
FrictionLimit = ( FrictionForce < MaxStaticForce ) ? MaxStaticForce : MaxDynamicForce
I then setup 3 friction constraints for the solver using FrictionPosition, FrictionLimit, FrictionDirection, and FrictionNormal like so:
a) 1 constraint for movement along FrictionDirection,
b) 1 constraint for movement along CrossProduct( FrictionDirection, FrictionNormal )
c) 1 constraint for rotation only around FrictionNormal
It seems to be working okay, although I'm not sure how mathmatically correct it is.
A couple of questions I have is
A) For 1) when computing the "NormalForce" do I take the average of all the contact point normal forces or the total?
B) Is my static/dynamic friction limit test mathematically correct?
thanks
Steve.