Real Car Physic

Started by
11 comments, last by Inferiarum 11 years, 9 months ago
Hi everyone,

I want to make a car simulator long time ago, and the first step is the car's physic.
I'm not so good at physic so I need your helps.

The first thing that I'd like to implement is the velocity and braking. I want a realistic physic and I want customizable cars, so the datas which are known:
- wheels position, radius
- engine: power (in Kw or Hp) (...?)
- gear: ratios
- other things that are necessary

So I want that I control only the gas-pedal from the code. I give a little gas, the engine gives power, the gear and differential reduce / increment the power / RPM(?), etc. and the wheels start turning which moves the car forward (or just spinning)

I know that I know nothing :) so I hope someone could help me.
sorry for my bad english
Advertisement
Well, the torque of the engine is a function of the gas pedal position the current revs and the gear. The acceleration of the car is proportional to the torque. You could also consider the torque of inertia of the wheels and the friction of the wheels on the ground.
I've started searching and I've found some basic forces:
- forceSum = 0
- the car's air resistance:

cDrag = 0.5f * frictionCoiffient * frontalArea * AIR_DENSITY;

fDrag = -velocity * speed * cDrag;
AddForce(fDrag);

- the car's rolling resistance:

cRR = cDrag * 30.0f;

fRResistance = -velocity * cRR;
AddForce(fRResistance);


Now I'll get the engine's force by the torque. My first idea is:
- Because the RPM/Torque curve isn't linear, I'll create an approximation: I'll pick some pairs: RPM - Torque, and I'll interpolate between this values.
- I'll multiply the engine's force (torque) by the gear and differential ratio, so I'll get the front wheels' torque

Yet, I don't know what I can do with these values (compute the wheels' speed from the torque, or the force which effects to the ground, ...).
sorry for my bad english

- the car's rolling resistance:

cRR = cDrag * 30.0f;



ouch.. rolling resistance 30x air drag? :P Somebody must have put sticky glue on your tyres :D
That can't be right, RR is a tiny fraction of air drag... recheck your sources.

Also in your air drag formula there is "speed" and "velocity".. I assume you are working in 1D right now so, what's the difference between the 2?

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

if you divide the torque by the radius of the wheels you get the force driving the car.

but i do not understand why you calculate the rolling with the cDrag constant. It is rather dependent on the weight of the car, the wheel radius and the material. It also should be independent of the velocity.

edit: Ah i get it, the velocity is the direction and the speed the absolute value, right?
I used this tutorial: http://regedit.i365.pl/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html
and some formula from the Physic of Racing series

The velocity is a vector-value, so it has a direction. The speed is the length of the velocity.

The force of drag is: http://www.gamedev.net/index.php?app=core&module=attach&section=attach&attach_rel_module=ccs&attach_id=3917
and the rolling resistance is: http://www.gamedev.net/index.php?app=core&module=attach&section=attach&attach_rel_module=ccs&attach_id=3920
but in the first tutorial, he writes that the rolling resistance is the drag resistances times 30.
sorry for my bad english
In the wiki article the rolling resistance is assumed to be constant with respect to the velocity, but well, i guess that is not that important an can be tested later on.

To simulate the car I would calculate the resulting forces for every wheel and with that the resulting change in velocity and angular momentum of the car
ya you are right, I thought it was multiplying the fDrag but it is not, my bad.
Still that RR calculation doesnt make any sense, RR is function of load on the tyre, velocity and slip... no relationship at all with air drag.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni


ya you are right, I thought it was multiplying the fDrag but it is not, my bad.
Still that RR calculation doesnt make any sense, RR is function of load on the tyre, velocity and slip... no relationship at all with air drag.


In the tutorial he mentioned it is just used as a rough estimate. I mean you have to use some number.
Yes, the cRR is a rough estimate smile.png But okay, I'll read more about the rolling resistance.

Suppose that I computed the air resistance (like now) and for each wheel the rolling resistance, slipping and the most important: forces (from the wheel's torque didided by the radius, Like Inferiarum wrote). Then should I have to compute a world matrix from the 4 wheels values? So I know the CG (Center of Gravity) and the position and forces of wheels, then compute a world matrix? Because I have to render the model which needs a world matrix. But if I use only the forces of wheels, where comes on the gravity and the other forces?

I've learnt (long time ago in a galaxy far far away smile.png) that the resultant (force) is the sum of the forces, so the velocity + gravity + etc. But if the car is drifting, the rear wheels are sliding and if I sum the forces, I'll have a "translation", not a "rotation". Or I don't know how I should write my problem biggrin.png

EDIT:
Oh, and thanks for your replies. :)
sorry for my bad english

This topic is closed to new replies.

Advertisement