#### Archived

This topic is now archived and is closed to further replies.

# Car Physics

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

## Recommended Posts

Hi, I''m implementing the physics of a racing car game. First of all, I modeled the car as if it wouldn''t be on the road. When I push the accelerator pedal, I increase the engine''s RPM. This acceleration is pretty fast. Then, I get a torque (from the engine torque curve), and, depending of the current gear ratio and differential ratio I get the torque on the rear axle and the rear axle''s RPM (the rear wheels are directly connected to the rear axle). I get this: on the rear axle, more torque, less RPM and vice-versa. ¿Is this right?. But my real problem is this: I can''t get a realistic representation when a put the car on the road. There''s an error with the interaction between the car and the ambient. I get the force excerted on the floor (wheel torque / wheel radius) and I add the resistance forces (drag and rolling resistance). I make the weight transfer, and I check if that force exceeds the maximum traction force (Fmax = mu * W). If it''s exceeded, the wheels slip. If not, I apply the force. The problem is that the engine''s RPM acceleration is still too fast (just like when the car wasn''t on the road). I''m open to suggestions. Adrian Brunetta (Sorry, I speak spanish!)

##### Share on other sites
I don''t know a whole lot about car physics but there is an open source racing game that you should check out. Look on the links page, there are some great links to car physics stuff.

www.racer.nl

##### Share on other sites
Hello Kaze,

I''m afraid I don''t have any experience with writing racing games, but maybe I can offer some general advice.

First of all I think the approach sounds good, model the car and it''s motion along the road separately - connected by the friction with the road.

A moment searching on google turned up this page on car physics in games. It looks really comprehensive, and it looks like you are on the right track (the pun wasn''t intended). http://home.planet.nl/~monstrous/tutcar.html

You may find that you''ve made some error in calculating the RPM for the rear axle (as shown by the problem you first describe). I would imagine (I haven''t really read the above webpage) that you take the torque on the back wheel, calculate the force on the road from the tyre (using T = F * R as you describe), then check the resistance.

At this point beware that there are two types of friction coefficient mu, the static friction and the kinematic friction. Static friction is where the wheels would be at rest compared to the road. So they are not rotating, the car is static, (and the road is not moving *grin*). Once the net force (for example from your torque on the back wheel) exceeds this static frictional force then the car can move. But then once it is moving you use the coefficient of kinematic friction which if I remember correctly is generally less than the static coefficient. So check if there is already relative motion and if so apply the kinematic friction to get the new force. Once you''ve got this force you can just integrate as normal to find the new car acceleration and velocity.

I''m not sure if this is of any help, but the website looks really good so check it out. I should be able to help with any specific queries on the maths/physics on that site. Let us know how you get on - or if you''re even more confused

Good Luck!
-- Chris

##### Share on other sites
hi again,

Just another thought which may help you out. Are you developing this with your game engine already in place, or are you looking at the physics separately???

I find it is useful to do this kind of investigation by writing small programmes which do the physics without any complication of graphics etc.. Where you can output data files containing forces, accelerations, velocities, RPM's etc at a function of time and you can then plot them, perhaps giving you an insight as to why your simulation isn't working quite correctly. You can even do this kind of thing in Excel, or if you have access to them, something like Matlab or MathCAD.

It works for me

-- Chris

[edited by - csarridge on December 3, 2002 8:58:32 AM]

##### Share on other sites
Hi again! Cris, I read the page you recommended, thanks! It''s been very helpful. I solved the main problem:
When I was accelerating the car, I wasn''t recalculating the RPMs (for the rear axle, for the transmission, and for the crankshaft) from the current car speed. In other words, I wasn''t modeling the "physic reaction" from the road. Now, in first gear, the car accelerates faster than in fifth gear, but I reach the top speed in fifth gear (the gearbox has five gears). Just like reality.
But, then I had another problem: when I wasn''t pushing the accelerator pedal, the car continued accelerating (but slowen than pushing the pedal).
I found a solution: I''m not a physicist, but I suppose that when I''m not accelerating the engine, this doesn''t delivers any torque (though the crankshaft continues rolling until stops). Is this right?

Anyway, I''m having another problem when I calculate the weight transfer. It''s related with the car acceleration, but I''m getting a very unnatural chassis rotation (it''s not a smooth rotation).
Should I interpolate between differents acceleration values?

##### Share on other sites
Hi Kaze,

Glad to know you''ve got it sorted out. It sounds quite cool - I like it when you get something to work like reality

From what I''ve understood from the website and from what you''ve said it sounds like you are right in your interpretation of the acceleration when you take your foot off the accelerator. As I understand it the torque and the RPM are related, so once you''ve accelerated the axle up to a certain RPM, it can still deliver torque even without being accelerated. So the car may still accelerate, but the acceleration of the wheels, coupled with the friction will tend to reduce this RPM on the axle (it will essentially generate an opposite torque on the axle) and hence the torque it can provide - making the acceleration tend to zero. So what you are saying sounds reasonable. Although please bear in mind that I''ve never done any car physics!

The only thing I can think of with the chassis rotation is that your time step is quite large which makes the rotation ''jump''. I think I would be tempted to try and decrease the stepsize in your integrator.

-- Chris

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633678
• Total Posts
3013291
×