• 13
• 18
• 19
• 27
• 10

Chris Hecker's Rigid Body Dynamics + friction

This topic is 3693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello, I've been obsessing again recently over an unsolved problem that I only kind of stopped thinking about for a few months. Chris Hecker's article about collision response In that article, Chris ignores friction. As it turns out, he did so precisely because friction is pretty painful to simply encode within a single formula. In the Chipmunk physics engine, friction is handled by rotating some vectors to the right and then treating friction as an inelastic collision. This, in turn, may return an impulse that causes the two objects to interpenetrate again, but much less than the initial impact. As a test, I modified the core algorithm to accumulate the collision response until the interpenetration was very small. It took 30 seconds per frame! I recorded the outputs and played it back, and what I got was better than any 2D physics engine that I've seen. This piques my curiousity enough that I'd like to ask you guys about the plausibility of some ideas that I have: 1) Is there an explicit solution to get the normal and tangental impulses explicitly if friction was also considered? 2) Do you think that if the entire system was rotated and scaled such that r1 was always (0,1), that I could store a detailed enough N dimensional lookup table to get the integrated solution? 3) If I generated that lookup table, how likely is it that upon observing the data that a simple polynomial approximation of the explicit solution could be found?

Share on other sites
1. I think that there is some sort of explicit solution for collision response/friction, but that solution becomes very complex when more than two bodies are colliding. Check out the book Dynamic Simulations of Multibody Systems by Murilo G. Coutinho for a rigorous discussion of traditional non-penetrational LCP/friction solvers. As a pragmatist, I don't see very much practicality in trying to completely eliminate penetration in a simulation targeted for real-time systems, the results are hardly noticeable in most cases. Only for simulations requiring extreme precision should this kind of rigor be reserved.

2. sounds possible, but you'd have to use a fixed time step for the values to have any meaning.

3. doubtful, but you never know.

interesting ideas, nonetheless.

Share on other sites
You need to determine whether or not static or kinetic (dynamic/slipping) friction is going to be used. You basically do this by considering the maximum static friction force (in the tangential direction) that is possible based on your values of the normal collision impulse and the coefficient of static friction for the collision in question (material properties, just make these up or look them up in a book). If, when you apply the maximum static friction force, it does not cancel or reverse the tangential velocity at the collision point, then you apply dynamic friction force. Else, you apply the force that will cancel relative tangential velocity (which will be less than or equal to the maximum static friction force).

This function calculates the force required to create a change in velocity at a certain point on a rigid body:

double	GetImpulseForceMagnitudeFromDeltaVelocity(double	DeltaVelocity,Vector3 & R1,Vector3 & line_of_action,RigidBody&a){		Vector3	R1crossNtimesJ1 = a.mJInverseGlobal*CrossProduct(&R1,&line_of_action);		double	denominator(0.0);		denominator	= a.GetMassInv() + 		DotProduct(&line_of_action,&CrossProduct(&R1crossNtimesJ1,&R1));		return	(DeltaVelocity / denominator);}