The physics behind skidding...?
Hi there, I''m currently developing a primitive 3D racer, and I''ve come to the point where I need to implement some physics...I am tackling the problem through some lateral thinking, but I''m hoping that someone out there can save me some time by pointing me in a particular direction!
Any thoughts will be greatly appreciated!
Thanks for listening,
Tin
Well I don''t know how realistic you want your skidding to be, but the basic idea behind it is this:
When a car is going in a direction that is not parallell to it''s wheels (in a turn for example) the car will not only undergo forward/backward wheel friction, but also sideward wheel friction. The thing is that this sideward friction is a lot higher. (Try to move a toy-car sideways across a table with it''s wheels on the table.)
Now what you do, is you decompose the car''s velocity vector into a forward vector and a right vector. Then you apply different friction on each of these and put it back into the velocity vector.
Here''s some C++ish 2D pseudo code (I''m asuming you know some basic vector math):
This is all from the top of my head so there might be errors in it. But I hope this gets you started.
When a car is going in a direction that is not parallell to it''s wheels (in a turn for example) the car will not only undergo forward/backward wheel friction, but also sideward wheel friction. The thing is that this sideward friction is a lot higher. (Try to move a toy-car sideways across a table with it''s wheels on the table.)
Now what you do, is you decompose the car''s velocity vector into a forward vector and a right vector. Then you apply different friction on each of these and put it back into the velocity vector.
Here''s some C++ish 2D pseudo code (I''m asuming you know some basic vector math):
|
This is all from the top of my head so there might be errors in it. But I hope this gets you started.
Dirk =[Scarab]= Gerrits
Hey thanks!
I just looked through my Game Dev. mags and found a good article that covers exactly what I''m looking for...but your ''solution'' has certainly simplified the problem for me!...I always had a sound theory, but couldn''t think how I could put it into code...
One (very naive) question about your code though: You mention a "right" vector...will I need a "left" one aswell?...or will a general "sideways" vector (like you mentioned in the comments section of your code) suffice?
thanks again...
Tin
I just looked through my Game Dev. mags and found a good article that covers exactly what I''m looking for...but your ''solution'' has certainly simplified the problem for me!...I always had a sound theory, but couldn''t think how I could put it into code...
One (very naive) question about your code though: You mention a "right" vector...will I need a "left" one aswell?...or will a general "sideways" vector (like you mentioned in the comments section of your code) suffice?
thanks again...
Tin
You only need one vector to represent the sideways motion of the car - the "right" vector can represent movement to the left if its magnitude is negative.
Sorry about the confusion. But Krunk helped you out just fine.
Anyway, here are some ideas for you on how to extent to this basic algorithm: Apply the forward and right friction to each of the wheels seperately and on the car's body as well (air friction). Hold the wheels and the car's body together with springs. This produces some rather neat effects. Just make sure you create realistic (read: believable) frictional coeffecients (sp?) for the different tires and car bodies.
EDIT: one more thing, in my first post I did a simple
And if you go with the more realistic method above, use tireMass and bodyMass and such.
Edited by - Scarab0 on December 31, 2001 6:43:19 PM
![](smile.gif)
EDIT: one more thing, in my first post I did a simple
velocity -= friction * delta_time;
but friction is actually a force, so it should be:velocity -= (friction / carMass) * delta_time;
And if you go with the more realistic method above, use tireMass and bodyMass and such.
Edited by - Scarab0 on December 31, 2001 6:43:19 PM
Dirk =[Scarab]= Gerrits
How would you handle the actual skid, i.e. once you start leaving visible tread on the pavement? I assume you switch coefficents of friction, but how do you decide when to switch?
Keys to success: Ability, ambition and opportunity.
Darn, I noticed another flaw in my pseudo-code. right_amount and forward_amount should be multiplied by some frictional coefficients. Otherwise the friction will be too large or too small.
Once abs(right_amount) gets beyond some specified value, the tires will leave skid marks. I don''t really know why though. I guess the frictional force exceeds the tire''s structural integrity(sp?).
quote:
Original post by LilBudyWizer
How would you handle the actual skid, i.e. once you start leaving visible tread on the pavement? I assume you switch coefficents of friction, but how do you decide when to switch?
Once abs(right_amount) gets beyond some specified value, the tires will leave skid marks. I don''t really know why though. I guess the frictional force exceeds the tire''s structural integrity(sp?).
Dirk =[Scarab]= Gerrits
quote by Scarab0:
Once abs(right_amount) gets beyond some specified value, the tires will leave skid marks
the tires would also leave skid marks if forward_amount was far enough away from the actual speed of the tires. couple quick examples: ex. car is going forward but tires are locked up (braking). ex2. car is going backward and tires are spinning forward.
- jeremiah
http://fakemind.com
Once abs(right_amount) gets beyond some specified value, the tires will leave skid marks
the tires would also leave skid marks if forward_amount was far enough away from the actual speed of the tires. couple quick examples: ex. car is going forward but tires are locked up (braking). ex2. car is going backward and tires are spinning forward.
- jeremiah
http://fakemind.com
- jeremiah http://fakemind.com
quote:
Original post by fakemind
the tires would also leave skid marks if forward_amount was far enough away from the actual speed of the tires. couple quick examples: ex. car is going forward but tires are locked up (braking). ex2. car is going backward and tires are spinning forward.
Yes you''re quite right. So maybe skidding for tire number i should be determined by the length of the vector: car.velocity - car.tire.velocity?
Dirk =[Scarab]= Gerrits
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement