racing car cornering
by Kevin · in Technical Issues · 01/08/2003 (6:48 pm) · 9 replies
hi, i have been working on this car racing game by using TGE. i am using waypoints for my AI controlled cars. It works fine if my cars' maximum wheel speed is under 30 but if it gets any higher, the cars starts to spin out of control and skid far away. i need an equation which would take some variables such as the mass, speed and corner angle and tell me the max speed the car can turn. so i could adjust the speed accordingly.
i did some research and find out some equations but not sure if they are good enough since TGE's simulation is much more complicated.
please read the first solution on this link:
http://www.crashwhite.com/physicstutoring/sampleproblems/sampleproblemch6/spch6no2.html
in the end of problem a, it provides an equation which is: the maximum velocity = sqrt(r*friction*mg/m)
1)Is this good enough? because TGE has so many variables for cars, tires and spring.
2)Does anybody know any more theory or equation/methods i could use for AI car cornering?
i did some research and find out some equations but not sure if they are good enough since TGE's simulation is much more complicated.
please read the first solution on this link:
http://www.crashwhite.com/physicstutoring/sampleproblems/sampleproblemch6/spch6no2.html
in the end of problem a, it provides an equation which is: the maximum velocity = sqrt(r*friction*mg/m)
1)Is this good enough? because TGE has so many variables for cars, tires and spring.
2)Does anybody know any more theory or equation/methods i could use for AI car cornering?
#2
i didn't think of checking out what they might have at gameDev.net
i'm pretty sure i could find something from that.
thanks alot James
01/08/2003 (10:39 pm)
oh ho ho ho ho..... :)i didn't think of checking out what they might have at gameDev.net
i'm pretty sure i could find something from that.
thanks alot James
#3
The "circle turning" problem comes from the "GetMoveList" function. These function works with the classic player but not with vehicles.
My developper rewrite this function and now all works fine. Vehicles can turn at any speed and the MoveForward & SetMoveDestination console methodes are fully available.
We plan to post it as a ressource in a few days.
Christophe CANON
01/08/2003 (11:20 pm)
Kevin,The "circle turning" problem comes from the "GetMoveList" function. These function works with the classic player but not with vehicles.
My developper rewrite this function and now all works fine. Vehicles can turn at any speed and the MoveForward & SetMoveDestination console methodes are fully available.
We plan to post it as a ressource in a few days.
Christophe CANON
#4
01/08/2003 (11:29 pm)
BTW Christophe, i did not look at it for the plane for the moment. I need to finish a new mission mod, and then i promise i will update it for the plane.
#6
You said that "Vehicles can turn at any speed". Do you mean that we could set the speed to any number at any time. That would be much easier but wouldn't it be cheating AI?
01/09/2003 (10:32 am)
Canon, i realized that it all depends on the code inside "GetMoveList" function.You said that "Vehicles can turn at any speed". Do you mean that we could set the speed to any number at any time. That would be much easier but wouldn't it be cheating AI?
#7
Seems to me that you could simplify it down to combining 2 equations.
combine the equation for Centripital Force:
Fc = m(v^2)/r
where Fc is the Centripital force, m is mass, v is velocity and r is the radius of the turn.
With the force of friction:
Mu= Ff/Fn
where Mu is the "stickiness" between the surfaces (the tire and the road), Ff is the force of friction and Fn is the Force Normal of the car.
Fn will always be perpindicular to the angle of the surface that the car is driving on. This is where you take banked curves in to account.
When Ff = Fc is the point that the car will start slipping. SO.
Fn/Mu = m(v^2)/r
thus, the max velocity that the car can take the curve will be about
v = ( (r*Fn) / (Mu*m) )^(1/2)
A few notes... this is based on newtons laws, which are based on a perfect world. This would probably work in a video game, but would only be an estimate in real life. You can always add more forces to the equation if you want to make it more complex.
also, it has been a few years since I took physics, so please feel free to correct me, or to even tell me that I am totally wrong. I personally have never done physics programming, so I am unsure how feasible this solution is.
Hope this helps you at least move towards your final goal :)
01/09/2003 (11:02 am)
*EDIT* Whelp, im a moron. I just re-read your post and saw that you already had this part. Ill leave it up anyway :D */EDIT*Seems to me that you could simplify it down to combining 2 equations.
combine the equation for Centripital Force:
Fc = m(v^2)/r
where Fc is the Centripital force, m is mass, v is velocity and r is the radius of the turn.
With the force of friction:
Mu= Ff/Fn
where Mu is the "stickiness" between the surfaces (the tire and the road), Ff is the force of friction and Fn is the Force Normal of the car.
Fn will always be perpindicular to the angle of the surface that the car is driving on. This is where you take banked curves in to account.
When Ff = Fc is the point that the car will start slipping. SO.
Fn/Mu = m(v^2)/r
thus, the max velocity that the car can take the curve will be about
v = ( (r*Fn) / (Mu*m) )^(1/2)
A few notes... this is based on newtons laws, which are based on a perfect world. This would probably work in a video game, but would only be an estimate in real life. You can always add more forces to the equation if you want to make it more complex.
also, it has been a few years since I took physics, so please feel free to correct me, or to even tell me that I am totally wrong. I personally have never done physics programming, so I am unsure how feasible this solution is.
Hope this helps you at least move towards your final goal :)
#8
i got my equation working. ...... But the AI is now a safe driver. he is just making sure he won't skid when making a turn haha.
i think what i need to do now is to calculate how much distance he would skid when driving at higher velocity. And make sure he doesn't skid out of the track and still moving as fast as possible.
01/10/2003 (1:42 pm)
Thanks anyway:)i got my equation working. ...... But the AI is now a safe driver. he is just making sure he won't skid when making a turn haha.
i think what i need to do now is to calculate how much distance he would skid when driving at higher velocity. And make sure he doesn't skid out of the track and still moving as fast as possible.
#9
03/09/2007 (5:41 am)
Hi, Am new to Torque, Am trying to make an AI Controlled car. Please gimme any reference code or how to implement that. Any help would be great. Thanks in advance.....
Torque Owner James \"Corvidae\" Williams