•      Sign In
• Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a \$50 Amazon gift card. Click here to get started!

# [Car Physics] - Angular Velocity / Angular Momentum

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

14 replies to this topic

### #1jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 23 September 2012 - 08:04 PM

Hi everyone,

I actually use a physics engine for my racing game (physX) with a some rigid bodies.
Basically, i have 4 wheels that have a rigidbody on it and these wheels are connected to the body of the car via a spring.

I use Pacejka typical curves to simulate the tire model.
I have no problem so far regarding the basic move of the car, it work pretty well i would say.

But recently, i have played some nice racing game simulation and some car crash videos on youtube and noticed that something important was missing to my car simulation.

The Angular Velocity / Momentum !

In fact, my car behavior act like there is no angular momentum at all.. I mean, the weight of the car doesn't feel right..

For example, if i turn on the right at medium speed, and then counter steer, my car will NOT spin and loose control, the angular speed is immediately stopped..

But i don't think its like my car have too much lateral grip, its something different i think...

Something must be wrong on my rigid body settings..

My 4 wheels rigid body are about 40 kg each, and the car body is around 1400 kg.
I have tested with more weight on wheels and less on car body but, it doesn't fix the problem, actually its getting a little bit worst.
The best results i have so far is around 30 - 50 kg for each wheels.

Do you guys have any suggestions on this ?
How can i have a stronger angular velocity ?

i would like my car to spin!

Any suggestions are very welcome.
Thank you for reading.
Please forgive my bad English.

Sponsor:

### #2bmarci  Members   -  Reputation: 484

Like
1Likes
Like

Posted 24 September 2012 - 03:45 AM

Hi,
Does the PhysX calculate with friction between your wheel geometry and ground?
If so, it could add damping force to your pacejka forces. Try to ignore lateral forces first (set Fy=0) and see if you can turn the car.
Also you can try modifying the lateral pacejka curve. If it generates too much grip your car won't spin.

### #3kunos  Crossbones+   -  Reputation: 2225

Like
1Likes
Like

Posted 24 September 2012 - 05:14 AM

You also need to set the inertia tensor for the rigid bodies. IIRC PhysX calculates it for you if you attach shapes to the rigid body, but for a car simulator it's much better if you get in control of these things. You might have your angular inertia very low.

Also make sure you get the terms right, angular momentum, velocity and inertia are very different things. It's impossible you "don't have angular velocity" if that was true, your car wouldn't rotate at all (ie. won't turn). Angular inertia is the rotational equivalent of mass.

Edited by kunos, 24 September 2012 - 05:17 AM.

### #4jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 24 September 2012 - 08:02 PM

Hi bmarci, hi kunos.
Thank you very much for your input.

Does the PhysX calculate with friction between your wheel geometry and ground?

I am not using the usual friction for my wheels, i set everything to zero. (Like its on ice).
That way i am sure to control the friction myself with the pacejka curves.
If i lower the lateral curve it work better but its still not enough.. And if i lower the lateral force too much, it become less realistic in my simulation..

You also need to set the inertia tensor for the rigid bodies. IIRC PhysX calculates it for you if you attach shapes to the rigid body, but for a car simulator it's much better if you get in control of these things. You might have your angular inertia very low.

Thank you kunos for this great input !
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-inertiaTensor.html

You was right !
I will try to set the inertia tensor myself, play with it and see if it help me to get the desired result.
I'll give feedback very soon.

Also sorry about using not correct terms. its been confusing to me. I will make additional researches.

### #5jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 25 September 2012 - 08:02 PM

Arf.. I tried to play with the inertia tensor, but sadly, that does not solve my issue..
I guess the problem should be somewhere else.

First i would like to confirm how i apply the lateral force on tires.

Basically, i get the tire slip angle, then, the slip angle is used as input to get the pacejka latera output force.
Then, i apply the lateral force like this :

Vector3 lateralForce = this.transform.right * pacejkaLateral;
this.rigidbody.addForce( lateralForce );


That may explain why the angular velocity of the car is stopped so fast in my sim ?

### #6kunos  Crossbones+   -  Reputation: 2225

Like
1Likes
Like

Posted 25 September 2012 - 10:51 PM

as your simulator grow more complex you will see that it is impossibile to blame a single thing for something... just as a real car it all becomes a game of balance and deep understanding of car dynamics becomes essential.

For sure I see a problem in your code, you are adding the lateral force at the wheel center and not at the wheel contact point, this is clearly wrong, and one of the effect would be to reduce lateral weight transfer left/right. Also the "right" vector of the tyre isn't the right direction for the lateral force that is generated on the plane of the road.. if you add it like that, the force will start to point "up" as the car rolls, this is wrong and will reduce load, thus grip.

The behavior you explain in your first post is not necessarily wrong , a well balanced car will not spin out.. but anyway the situation can be explained by a HUGE number of factors.. some examples?

- Too much grip from the tyres.
- Wrong units fed to pacejka formulas (this is VERY common)
- Wrong parameters to pacejka (this is also VERY VERY common, cut & paste won't do, to properly use pacejka it is essential to deeply understand both tyre dynamics and how that formula is trying to approach and model the problem.)
- Angular inertia too low (tyres can stop angular velocity too quickly)
- Angular inertial too high (tyres can't unbalance angular velocity enough.. see what I did there? )
- Rear tyre grip too high compared to front tyres (car will always autobalance itself)
- Wrong lateral and longitudinal force combination.. if there is a combination at all
- Wrong weight transfer calculations ... too much weight at the back

as you can see, there is a huge number of possible explanations, but the morale is, if you want to do a car simulator you NEED to get yourself very comfortable with car dynamics, tyre modeling and the concept that "everything influences everything else".. there is no shortucut for it.

Edited by kunos, 25 September 2012 - 11:04 PM.

### #7jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 25 September 2012 - 11:36 PM

Kunos, thank you very much for your very valuable input.

I know that its all about balance, and sometimes changing a simple parameter will after the whole driving feel and car behavior.
Basically, i am pretty sure of the output i got from pacejka, in fact i do not use the pacejka formula in itself, but i create the curve with a bunch of Math formulas.

The part that i have been actively looking is the force combination, i have already experimented few of them, that allow me to do some donuts and cool power-slides.

Anyway, that's just another issue.
Also, i forgot to mention that there is no weight transfer in my simulation, the load on the tire is always the same.
That may explain also some issue i have.

I will investigate furthermore..

### #8PochyPoch  Members   -  Reputation: 158

Like
0Likes
Like

Posted 26 September 2012 - 07:35 PM

Hi everyone. I have read this very closely as i have my issues with my own car sim. (So now we are at least 3 guys needing help ^^)

I agree with kunos, you can have the same behaviour with different parameters. For example you can have oversteer if you accelerate during cornering and outrange the traction circle on rear wheels. But the weight transfer created by the acceleration can add more weight to the back of the car and thus, produce understeer. Depends of settings i guess, or maybe i missed something again.

Vector3 lateralForce = this.transform.right * pacejkaLateral;
this.rigidbody.addForce( lateralForce );

If the body is the wheel, i do the exact same thing. My sim is not perfect (far) but it seemed ok for basical handling.

For sure I see a problem in your code, you are adding the lateral force at the wheel center and not at the wheel contact point, this is clearly wrong, and one of the effect would be to reduce lateral weight transfer left/right. Also the "right" vector of the tyre isn't the right direction for the lateral force that is generated on the plane of the road.. if you add it like that, the force will start to point "up" as the car rolls, this is wrong and will reduce load, thus grip.

At the wheel center and not at the wheel contact point > I know you're talking about 3D sim, but mine is 2D. So lateral force is just lateral force, applied at the wheel attach point, as it cannot more on ground than on wheel center, and i already have a LOT of lateral weight transfer, i have to limit it. My lateral transfer is calculated by me using lateral acceleration provided by total lateral forces on the body. I don't really understand the implications of that phrase for a 2D sim.

"right" vector of the tyre isn't the right direction for the lateral force that is generated on the plane of the road > Again i have trouble to understand what you mean. You mean if the contact patch is at some inclination, the lateral force should respect this patch position ? If it is it, again in 2D, i am not concerned directly.

The behavior you explain in your first post is not necessarily wrong , a well balanced car will not spin out...

Well it makes me think, probably none of us has a really good model of a "well balanced" car. At least i have read nowhere : "this is the data of a fun drift car", and "this is the data of some nice stable car".

If jujunosuke & bmarci agree with that idea, maybe we could start to share a model with preset parameters which could help us to understand what we are doing right, and what we are doing wrong

Also, i forgot to mention that there is no weight transfer in my simulation, the load on the tire is always the same.
That may explain also some issue i have.

I would say yes. I can do some extremely fast spins with weight transfer activated (front/rear). I suggest you try to activate it and see if braking + steering allows for a fast car spin. If it is extremely fast and uncontrolable drifts, well you might have reached the same point as bmarci and me ^^

### #9jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 01 October 2012 - 01:01 AM

"right" vector of the tyre isn't the right direction for the lateral force that is generated on the plane of the road > Again i have trouble to understand what you mean. You mean if the contact patch is at some inclination, the lateral force should respect this patch position ? If it is it, again in 2D, i am not concerned directly.

Yes, your are not concerned by this as its for 3d sims only.

I would say yes. I can do some extremely fast spins with weight transfer activated (front/rear). I suggest you try to activate it and see if braking + steering allows for a fast car spin. If it is extremely fast and uncontrolable drifts, well you might have reached the same point as bmarci and me ^^

Yep, i will try to implement this as well.

After reading some more documentation about the subject, i have found something interesting.

First the vocabulary i used was confusing. (angular momentum, velocity and inertia).

What i wished to say is "Rotational Inertia"
My car is missing Rotational Inertia.

After a violent turn in relatively high speed, my car should continue to rotate in the direction i turned, because rotational inertia of a car could not be stopped that easily.
(Because of the weight of the car body).
So, after making some more researches i found this :

When i reduced tyre longitudinal and lateral force of the tire, i noticed that the rotational inertia of my car was much more believable.
But unfortunately, the handling ability of my car became really weak.
In the contrary, with stronger force, the turn and acceleration felt really good, but the inertia of the car is really weak.

So, i conclude this has probably something to do with static and dynamic friction of the tire.
What do you think ?

In my sim, this notion is not implemented yet.

Here are few questions :

If i go straight at a steady 100 kmh, my tires are still in static friction ?
Is there any simple way to determinate when my tire friction change state ? ( static -> dynamic) and (dynamic -> static) ?

Should i decide few constants ?

Any help would be greatly appreciated.
Best regards.

Edited by jujunosuke, 01 October 2012 - 01:03 AM.

### #10kunos  Crossbones+   -  Reputation: 2225

Like
1Likes
Like

Posted 01 October 2012 - 01:19 AM

static friction only applies at velocity = 0 , so forget about that

As for "drift", it took me about 13 years to come up with a global model that allows my physics implementer to do a "drift" car... it really is that hard , and the more your model is complicated the harder it gets.

My suggestion is to start as simple as possible, neutral car, weight balance 50% front, same tyres front and rear... again, do not underestimate the role of differential modeling.. drift needs limited slip differentials, an open diff won't drift, and a spool won't drift.

Also, as I've said in other threads, calculating tyre load from lateral forces is fundamentally wrong, it'll disregard and destroy every action from the suspensions and tyres as springs.

### #11jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 01 October 2012 - 02:14 AM

Damn kunos you answer too fast

static friction only applies at velocity = 0 , so forget about that
As for "drift", it took me about 13 years to come up with a global model that allows my physics implementer to do a "drift" car... it really is that hard , and the more your model is complicated the harder it gets.

Reading this is as fascinating as discouraging.. hehe.

again, do not underestimate the role of differential modeling.. drift needs limited slip differentials, an open diff won't drift, and a spool won't drift.

In my sim, the real wheels turn both at the exact same rate, so i guess i already have a LSD config..

Anyway, after that much experience in car simulation, it is so great that you share your experience kunos.
Tyre modeling is just fascinating and extremely complicated at the same time..

Btw, this next question is not related to my post, but just for curiosity, what do you think about physics used in game like Gran Turismo 5 or Forza 4 ?
The tire model on this game is far to be perfect and is of course really simple compared to any good PC simulation.

BUT they have the quality to be correct simulation with correct car behaviour for LARGE audience public.

I know that you try to reach a kind of ultimate car simulation but, did these large public sims influenced you in any way ?

***EDIT***

What i mean is, we can control the car for laptime or drift with a simple standard controller, see the replay and still see acceptable car behaviour right ?
This have to be quite challenging...

Edited by jujunosuke, 01 October 2012 - 02:19 AM.

### #12Waterlimon  Crossbones+   -  Reputation: 3647

Like
0Likes
Like

Posted 01 October 2012 - 02:24 AM

static friction only applies at velocity = 0 , so forget about that

As for "drift", it took me about 13 years to come up with a global model that allows my physics implementer to do a "drift" car... it really is that hard , and the more your model is complicated the harder it gets.

My suggestion is to start as simple as possible, neutral car, weight balance 50% front, same tyres front and rear... again, do not underestimate the role of differential modeling.. drift needs limited slip differentials, an open diff won't drift, and a spool won't drift.

Also, as I've said in other threads, calculating tyre load from lateral forces is fundamentally wrong, it'll disregard and destroy every action from the suspensions and tyres as springs.

But, if the car is moving at steady 100 km/h, the relative velocity between the surfaces of the tires and the ground would be 0 so it would be static friction.

o3o

### #13kunos  Crossbones+   -  Reputation: 2225

Like
1Likes
Like

Posted 01 October 2012 - 02:32 AM

In my sim, the real wheels turn both at the exact same rate, so i guess i already have a LSD config..

nope.. that is a locked differential or a "spool", a limited slip allow tyres to turn at different speeds but in a "limited" (doh ) way.

A spool adds tons of understeer to the car because the rear tyres will oppose to any change in relative angular speeds trying to straight the car up. This understeer is usually transformed into "snap" oversteer as soon there is too much torque for the tyres to handle. The car will be really really hard to drive.

The new generation of console driving games (Forza and GT5) are very very good, expecially compared to the physics systems found in older "mass market" games.
I don't have a PS3 (only XBox) but I've enjoyed GT5 a lot every time I tried.

### #14kunos  Crossbones+   -  Reputation: 2225

Like
0Likes
Like

Posted 01 October 2012 - 02:43 AM

But, if the car is moving at steady 100 km/h, the relative velocity between the surfaces of the tires and the ground would be 0 so it would be static friction.

true but this never happens, and if it happens it'll be so instantaneous that isn't even worth investigating it.

### #15jujunosuke  Members   -  Reputation: 188

Like
0Likes
Like

Posted 01 October 2012 - 03:14 AM

nope.. that is a locked differential or a "spool", a limited slip allow tyres to turn at different speeds but in a "limited" (doh ) way.
A spool adds tons of understeer to the car because the rear tyres will oppose to any change in relative angular speeds trying to straight the car up. This understeer is usually transformed into "snap" oversteer as soon there is too much torque for the tyres to handle. The car will be really really hard to drive.

Excellent kunos !
Thank you for all these informative answers !
I guess i have all the answers i was looking for and its up to me from now

See you next time!
Best regards.

Edited by jujunosuke, 01 October 2012 - 03:15 AM.

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS