Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


[Car Physics] Sharing work, ideas, formulas and car parameters


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.

  • You cannot reply to this topic
37 replies to this topic

#21 bmarci   Members   -  Reputation: 401

Like
0Likes
Like

Posted 03 October 2012 - 04:01 AM

jujunosuke,
I'm sorry but I feel your post was not so constructive.


I will be difficult for someone who have a specific issue to find answers by looking at this thread..

As far as I understand this topic is not about a specific broblem, more likely about all problems. If you have a specific issue, just read the FIRT post which is constantly edited and expanded, as the discussion goes on.

When i look at the first post and the evolution of the thread, i can't find anything related.
Its like everyone is talking about his problem and mix everything.

Yes, because people usually don't share hard earnt techniques easily. So we must go the harder way to share our problems, and work out the answers together.
Kunos is the far most experienced here, but nobody expects him to copy/paste his super tyre model formulas/parameters that he worked out in many years, his comments are valuable but only showing the right directions.
This way you are right, the title of this topic will not work, PochyPoch was naive about it :) But since this topic became the most visited car topic, people ask here.

This title only is just nonsense...
There is no miracle recipe to make fun game or drift game.


I don't think any of us who just started playing with car simualtion are about to make hyper realistic simulation for a racing team or a car factory.
At this level, it's all about game and fun with an acceptable level of physical accuracy, and thus as everything in game programming it's all about cheating as much as possible. So there ARE miracle recipes as long as you are not a professional in aero dynamics or in suspension geometry setups.
Later when we work out everything about differentials and tyre simulation those magical solutions will disappear.

Again no offense, you want to help people and help yourself, thats a great idea, but you should at least do it seriously..

So then, let's help him make it better. The Marco Monsters' is almost 10 years old, and the only one well understandable for beginners.
You are partially right, this tutorial hasn't reached that level, but I'm sure in time it will.
It's high time someone started making an extended version :)

Sponsor:

#22 jujunosuke   Members   -  Reputation: 188

Like
0Likes
Like

Posted 03 October 2012 - 07:21 PM

bmarci, thanks for your answer and your point, but i think you don't get what i tried to say.
I am not native English so, it may be the reason i explained it bad.


I'm sorry but I feel your post was not so constructive.

It was, i tried to explain why this thread was confusing to me. If you don't want to admit that some people will not understand that thread thats your problem.
But don't say that my post was not constructive.


As far as I understand this topic is not about a specific broblem, more likely about all problems. If you have a specific issue, just read the FIRT post which is constantly edited and expanded, as the discussion goes on.


A web page with some photos, or even Flash based animation would be so much better than this post.

I don't think any of us who just started playing with car simualtion are about to make hyper realistic simulation for a racing team or a car factory.
At this level, it's all about game and fun with an acceptable level of physical accuracy, and thus as everything in game programming it's all about cheating as much as possible. So there ARE miracle recipes as long as you are not a professional in aero dynamics or in suspension geometry setups.
Later when we work out everything about differentials and tyre simulation those magical solutions will disappear.


I am not even talking about realistic simulation, i am talking about something really simple, the basics.
Beside the fact that marco monster is 10 years old, it cover everything so well, its just the best way to start in my opinion.

And gamedev forum should be there to help you to answer question on a particular point that you don't understand for example.

Of course, its always interesting to see some reading on car physics, a subject that passionate all of us, but the fact of melting all kind of question and answer together make it really confusing and not that easy and enjoyable to read IMO.

I don't have any problem with "tutorial" or "resource" kind of thread, but at least, it really need to be done more seriously.
That was my 50 cent.

Edited by jujunosuke, 03 October 2012 - 07:28 PM.


#23 PochyPoch   Members   -  Reputation: 158

Like
0Likes
Like

Posted 03 October 2012 - 07:22 PM

Hi to all beloved co-posters !

Bmarci, thanks a lot for saying what i was going to say ^^

More precisely, i would say, yes, this is going to fail, as almost any other car topic on the forum. Of course there are a lot of errors in my (very) simple explanation. The whole purpose was to get people to say "hey this is not the way you should do that !", or even more valuable "hey there is a faster/easier way to do that !". So if i had all knowledge already, i would finish my game and make a real tutorial instead of a "general car ways of doing things" topic Posted Image

My goal is ultimately to explain everything we learned on the first topic, and maybe if i estime myself enough give some advices (like do not believe marcos tutorial will give you a nice car ^^). I have a LOT of litterature on the subject i will post, etc. But right now, i feel like trying to make a "reference" first post is kind of a waste of time as there is too much things to discuss, and making it look "good" won't make it good for real. The idea is to get people to understand this is an open debate and ideas/tips sharing topics, which i hope will let us gather enough intel to be able to provide a few good advices on the first post.

As i see it, all kinds of handy formulas, links, tips, and even different "ways" of doing things will be explained in the first post. Bu right now, this thread is highly unrecommandable, especially for newcomers, there are better places to start, like marcos monster, phors or the tutorial on gamedev, which are all good reads.

And, finally yes, i think all noobies car devs are going the same way those times, and maybe a fresher starting point would be necessary.

Beside the fact that marco monster is 10 years old, it cover everything so well, its just the best way to start in my opinion.

Oh yeah, +1k to that. And maybe even before that getting familiar with driver knowledge before going into physics. The value of the first post when completed would not be to do what marcos did, but instead, starting where it stopped. So let's say you have implemented everything he said, and even a few more things, but you are very disappointed because your car is not feeling right. I already learned very valuable things (like role of differentials and so), that i think are worth explaining in the first post, in time, when i'll have implemented and understood them myself. And finally having a few videos demos, data sets and reference values would be a great contributions for people coming from marcos tutorial or trying to implement it.

Of course, its always interesting to see some reading on car physics, a subject that passionate all of us, but the fact of melting all kind of question and answer together make it really confusing and not that enjoyable to read IMO.

The fact is, we (i) have so many questions, i feel like creating topics for all of them would result in terrible forum flooding. So the idea is to ask things as they are coming, and when i figure out enough of them i'll summarize the first post well Posted Image And then it would be a great time for constructive feedback, as we are thinking towards future readers and explaining things correctly.

---

That being said, let's go back to main topic : car science alchemy !

---

EDIT : Wow i just realized there are very interesting things being said in the previous car topics ! Maybe some of my questions have been answered there. If that is don't bother linking the other topics, i'm reading them right now Posted Image

A few words on the differential topic i started : i was just talking of a flat multiplier in my sim actually : engineTorque * gearRatio * diff * throttleInput. Very dumb thing, compared to how advanced a real differential is. I personnaly do not use an axle, instead i add torque to the drive wheels directly, and so, they get individually slowed/accelerated in a corner. If cornering without throttle, the inner wheels is going slower than outer wheel (normal), but if cornering with throttle, that's the opposite. Actually wihtout differential, the inner wheel has to slide on itself, which works but is far from good. And must have an influence on cornering.

Anyway i just deactivated slip ratios, engine torque and all things related to concentrate on drifting and cornering behaviour. No traction circle either for now. So i'm not on power drifting, but more on braking->more weight to front->oversteer drifts.

I think i'll code real suspesions/springs and enhance my mastery of steering_input_control / general lateral forces manipulations before i get more into combined lateral and longitudinal grips. Step by step !

---

the easiest and more common way of getting load is to treat the tyre as a spring and get the load from that spring compression... no calculation needed.


That's right, you don't need to calculate this. In my case (Unity 3D) I have rigid body physics that just work. So my vehicle is constructed simply as a rigid body with 4 contact points and a simple suspension on each one (spring + damper). If I put this "vehicle" over a terrain it will behave as if it is sliding on ice (no friction) but suspension, weight transfer and weight load at each contact point will just work.


No calculations... does not work for me, sorry ^^ You mean the physical engine does it for you ? You mean, the spring/wheel will compress because of car accel, and the final force on each tyre will be way more reasonnable than in a vehicle without suspension ? I still have a doubt if you're suggesting NOT even consider car acceleration, or just don't use it AS IS because it is very stupid (which is obvious ! As you pointed it, even a tire is a kind of suspension on itself).

If that is what you mean, then we agree ! Either way, please explain further, the "no calculation" thing.

As all front/lateral forces get eventually multiplied by the wheel load, we can say getting the wheel load right is maybe as much or even more important than getting the initial values right. I had much trouble with that, and honestly for this particular subject i kind of miss examples. When i look at a big pickup truck i can see the springs getting highly compressed. Marcos state something like "xxx acceleration > formula > xxx Fz on back wheels, so you accelerate faster". The fact he didn't talked about car suspesions made me think :
  • It is not a very important part of the simulation (VERY wrong i think, now)
  • Suspension or no, i CAN get the force he is talking about, eventually, and maybe suspensions will just make the weight shift process a little slower (i guess it is really wrong too).

Here is a problem i still have : if weight transfer is more than a FEW percents, car can spin very easily or behave odd. When i see the raw acceleration weight transfer outputs, i find it hard to beleive spring/dampers can convert a totally incontrolable car in something smooth. So i looked elsewhere.... For a too long time. I mean, will i go from 15% weight transfer to 1% ? Or more from 15% to 12% ?

What is a typical cornering car weight transfer values ? On something like a lambo, and a drift car (to have extremes), if i decelerate from 200Km/H to 150Km/H, what can be the front/rear weight repartition at corner entry ? middle ? end ? Is it ok to have almost all cars to spin if the transfered weight ratio from back to front is more than 10% during serious cornering ? (i know you miss the steering and lateral tyres forces intel, but i'm just asking to have an idea of the effect of suspensions).

Actually i get pretty good results with 1% ~ 5% maximum weight transfer amount. It all depends of steering and lateral forces, wich varies from one car to an other.

---

3. Around 80/100 km/h, understeer with throttle, and oversteer without it.
Could be CG too high, too much "coast" torque.. wrong or missing implementation of a proper differential


I generally have this behaviour too. Slip angle is initially higher at front, it makes the car oversteer (with or without weight transfer). If accelerating, the cornering radius is getting higher very fast (understeering). Even more noticeable if you have an arcade front velocity directly coming from throttle instead of SR/torque. I think (hope) Kunos is right and a differential would help to create a front acceleration vector which has a small angle instead of 0. Thus helping in cornering. I was not confident trying to implement this for now, but i'm looking toward formulas and tips helping to create a diff. Unless the formulas are pure magic, i guess it is very hard to do this quickly.

---

Also it would be nice to see some real values, not curves, just sample values eg: (SR=0.01, Fz=3500N, Fx=???) and the same for Fy, just to see if we even have reasonable results.
Is there any "healthy" ratio between Fx and Fy (at peak). I just checked, and my FxMax is greater than FyMax.
Are these values reasonable for a 255/50ZR16 tyre:
Fx: Load=3KN, PeakSR=0.11, MaxFx=3240N, InputSR=0.03, Fx=2211N
Fy: Load=3KN, PeakSA=8.6°, MaxFy=2834N, InputSA=4°. Fy=2519N

+1. We need some real life values with a known-setup car to help us. Do you have the name of a book wich specifically has real examples ? Physics of racing maybe ?

---

A few questions :
  • What is a reasonably good lateral deceleration a tire can produce ? I mean, if i am at 50 meters/second front and want to turn right at 90° without making a huge drift, how much lateral G are realistic ? Or in other words what can be the cornering radius ? Reason i am asking this : my game is currently top down, and to see curves, they have to fit on the screen. So, i know my driving environment is far from realistic, and thus i need VERY good tires to turn. So let's say you kick a car lateraly so the Fy speed get instantaneously to 50 meters/s. What would be a reasonable stopping time ? 1s ? 5s ? I have done some research and it seems, F1 car do something like 5G of lateral acceleration, while a regular car is closer to 1G. But no one is trying to take a 90° corner with a regular car at 150 Km/H. I guess if it a crossover it is not even doable even if drifting ?
    If i have a 1500Kg car, with inertia of 3000 and a pacejka curve like this : peak@4° = 1.2, value@90°=1.0 my car handling is credible, but totally catastrophic, i cannot take any decent corner above 50KmH. I have to go to 20 or more in the 90° to make the car turn ok.
  • Do you see the peak of the long/lat curves as the maximum radius of the traction ellipse in that direction ?
  • Is there a formula to create an ellipse knowing the X/Y radiuses ?
  • If a front pacejka curve is not matching the lateral one : let's say i draw curves by hand and i am modifying them separatly as i try things. Is there a point at wich it is stupid to hope anything because those are so closely related (with SR/SA, traction circles) that everything has to be in perfect harmony (ie: lateral forces physically accurate regarding to front ones). That means i cannot let the player upgrade its front grip without having lateral grip to increase as well ?
  • In most car simulations, when the car starts to slide, it acts as it keeps sliding, like if a slide situation was more able to create a slide situation in the next tick. Or like if when sliding has started, the friction forces are modified. That make sense if you consider static/dynamic friction, but afaik, a tire cannot bo seen from this simple perspective. If i am cornering at 150Km/H, i guess everything is sliding here and there a little, and there no such thing as : "static friction, everything is alright"--> "sliding, so i have lost traction and cannot do much about it". But i don't know, we always read the patch is kind of "not moving" at a given time, so maybe even when cornering at high speed, i should consider the patch as static ? And then i would need to find out if it is in static or dynamic friction mode ? No idea if it is a legitimate question, and even less idea on how to determine that. Funny that jujunosuke had the same hope than me on this ^^ Anyway the response of Kunos is absolutly no static friction.
And finally, last but not least, something very important to me i am still not sure :
  • It is said the more acceleration, the more weight on the tire, and the more weight on the tire, the more grip. So why during intensive cornering, the outer wheels (which are the most loaded) are always the first to slide ? My guess ares :
a) It only happens when the lateral speed gets too high. So something related to static/dynamic friction like i am asking above. And lateral speed would be higher on outside side of the car ? Or even more crazy : in fact all wheels are sliding at the same time, the outside wheels are not always the first to slide in those situations.
b) Somehow the slip angles of the outside wheels are getting too high, the curve is getting down and slipping occurs ?
c) At some point, more weight means less force ??? I know the weight has diminushing returns on generated forces, it is not entirely linear. But when i looked at the values, even if not neglectible, it does not makes sense that the outer wheels slide first.
d) Only happens because of differentials + driver pushing throttle. So outside wheels are slipping, traction circle is outranged and increased weight is not important enough to counter the loss of magnitude of the "raw" lateral friction.
e) It is something else, maybe related to camber, or the fact that the car is simply not well balanced with too much weight on one side which means... too strong lateral forces ?

Edited by PochyPoch, 03 October 2012 - 08:28 PM.


#24 kunos   Crossbones+   -  Reputation: 2207

Like
2Likes
Like

Posted 03 October 2012 - 11:42 PM

lots of questions as usual... the no calculation thing is very easy.

Tyre is a spring, and should be modeled as such. Usually there are 2 approaches to modeling tyres/suspensions:

1) "Arcade" mode, the car is a single rigid body, suspensions and tyres are simulated with 4 ray casts and with a spring, or better, with 2 spring in series. In this case, the force that the spring will send to the car is also your load on the tyre.

2) "Sim" multibody approach. Here each tyre is a separated rigid body connected to the car body either with a joint, more joints, or more rigid bodies.
In this situation the tyre is a spring too, when it collide with the ground it will "sink" into it, this "deflection" is used as a compressed spring, it pushes tyre up at it represent your load. So simply:

tyres[i]->load = tyres[i]->deflection * tyres[i]->spring;

For tyres you are looking into the 200,000 N/m spring rate and a 400 N/ms for damping.
With this system, everything is "automatic" as long the point of application of your forces is correct. So you brake, the weight goes forward, it will "compress" the tyre more into the road (just as in real life) and by measuring this deflection you get the instant load. Links, suspensions, springs and dampers are automatically taken into account.

Tyre lateral grip
It depends a lot.. a typical road tyre will give you 1.0 - 1.1 G.. with load sensitivity and all you should get close to 1.0G on a skidpad. A normal road car with 1.0G lateral acc is considered VERY good (ie. the BMW Mini scores a tad less than 1.0G and is considered a very good handling car).
Casual players usually find this VERY low.. this has lots of possible explanations:

1) No real experience with real cars.. and I mean track experience in a competitive way, not the kind of experience you get being an idiot on public roads.
2) The result of 1 is that no driving skills are developed... typical sign, Joe-I-Go-Fast goes too fast into a corner, the car will understeer and he turns more into the corner, making understeer worse and going even more wide into the wall.
3) They are used to other games either arcade a-la PGR or F1 games where cars have huge amount of grip.

You can try to solve the problem by increasing the grip, but that will screw up everything else on the car, it will roll more, pitch more, and, since the tyres have a much bigger potential to generate forces, the car will be more twitchy..

Continuing the grip references, for a high performance road tyre (high end supercars) you see 1.2 - 1.3
Racing slick tyres range from 1.4 to 1.9 depending on compound.
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#25 kunos   Crossbones+   -  Reputation: 2207

Like
1Likes
Like

Posted 03 October 2012 - 11:50 PM

As for the loaded sliding tyre thing.
The first chapter of every car dynamics book will talk about "load sensitivity", which is an essential concept in car dynamics.
The more load on the tyre the more the friction coefficient goes down. A tyre that can do 1.2 at 1000N, might give you 1.1 at 2000N . That is why the loaded tyre will be the first one to "break" grip.
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#26 bmarci   Members   -  Reputation: 401

Like
1Likes
Like

Posted 04 October 2012 - 03:17 AM

2) "Sim" multibody approach. Here each tyre is a separated rigid body connected to the car body either with a joint, more joints, or more rigid bodies.
In this situation the tyre is a spring too, when it collide with the ground it will "sink" into it, this "deflection" is used as a compressed spring, it pushes tyre up at it represent your load. So simply:

tyres[i]->load = tyres[i]->deflection * tyres[i]->spring;

For tyres you are looking into the 200,000 N/m spring rate and a 400 N/ms for damping.


This is what I always had hard time to imagine :)
Using the spring/damper formula:

F = -kx - bv

where:
k is the spring rate, 200000 in your example
x is the deflection

So the load is simply kx?

Also, in a multibody situation, suppose the wheels are made of steel, so only one spring is there.
The spring would act on both the wheel and on the body. This becomes more obvious when the car lifts off the ground, so the spring pushes the wheel down and the body up.
In this case the applied spring force is divided between the wheel and body in the ratio of their masses. Is that correct?

#27 kunos   Crossbones+   -  Reputation: 2207

Like
0Likes
Like

Posted 04 October 2012 - 04:15 AM

no, a force is a force and is independent from masses. The spring is generating exactly the same force on both bodies, in opposite direction (Newton's third law) .

Acceleration, which is F/M becomes, of course, dependent on masses.
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#28 bmarci   Members   -  Reputation: 401

Like
1Likes
Like

Posted 04 October 2012 - 04:32 AM

One more thought on suspensions (for dummies (mostly myself) ) through an example.

For the simplicity I'd represent a car with a box with 4 corners for each wheel attachment point, and 4 points for the wheels' contact points.
The 4 points are constrained to the 4 corners of the car with a spring/damper.
To make our life more difficult let our wheels have their own mass.

The spring/damper has the following parameters:
k = spring rate
b = damping rate
L0 = restlength (is it the measured length of the spring if I put it on my table???, no forces acting on it)
Lmin, Lmax = minimum/maximum extensions (how much can it be compressed or stretched)

Given the spring formula; F=-kx-bv
where,
x = spring compression (difference between spring current length and restlength)
v = velocity difference between the two ends of the spring (if a wheel is attached this is the vertical speed of the wheel)


In the simulation step;
1. Suppose we have a working dynamics, our car starts freefalling at the first step.
2. The 4 wheels' contact points sink into the ground, so the "x" gets a nonzero value, thus one can calculate the current load on the tyre W=kx
3. Since x is nonzero a spring force is generated (F) that is applied to the contact point and the corresponding corner of the box.
4. If the wheel is touching the ground all spring force (F) is applied on the box corner, otherwise it's divided between the wheel and the body;
5. Applying that force back on the car body, changes its linear and angular velocity, and the vertical movement of the wheel
6. Now we can calculate the new x and v for damping in the next step. The Lmin and Lmax can be used to limit these values.

^^^ Could this work????


Couple of things to clarify;
1. Does the amount of weight transfer depend on the stiffness of the spring?
Or, is the same weight transferred with a 200kN/m spring as one with 50kN/m but much faster?
2. The value x is almost always nonzero, so the spring is never reaches the restlength and oscillates forever.
3. Maybe not relevant, but if the suspension has double springs (like all my lego cars) can it be handled as one, just summing the spring and demper rates?

Edited by bmarci, 04 October 2012 - 04:37 AM.


#29 kunos   Crossbones+   -  Reputation: 2207

Like
3Likes
Like

Posted 04 October 2012 - 04:43 AM

1. Does the amount of weight transfer depend on the stiffness of the spring?
Or, is the same weight transferred with a 200kN/m spring as one with 50kN/m but much faster?
2. The value x is almost always nonzero, so the spring is never reaches the restlength and oscillates forever.
3. Maybe not relevant, but if the suspension has double springs (like all my lego cars) can it be handled as one, just adding the spring and demper rates?


1 - weight transfer is the same, just happens at different speed
3 - There are formulas to combine spring rates in series or in parallel

Anyhow.. you seem to want to complicate things a lot :P .. they are REALLY simple:

Initialization:
1) Get a physics engine, PhysX, Havok, Bullet, ODE.. you name it
2) Create 5 rigid bodies.. 4 wheels and 1 car body.
3) Connect the best you can, slider joint is the easiest, fastest and more performant solution

Game Loop:
- Check tyre to ground collision... if you have a collision solve adding forces to the tyre (using the physics engine built in functions) at the contact point. These include vertical, lateral, longitudinal forces and torques.. vertical is a spring, lat/lon and torques come from your tyre model.
- Check tyre's positions wrt car body.. add suspension spring and damper forces accordingly using the physics engine built in functions

done.. you have a very good starting point for a simple simulator with all the weight transfer already accounted for
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#30 bmarci   Members   -  Reputation: 401

Like
0Likes
Like

Posted 04 October 2012 - 05:47 AM

Anyhow.. you seem to want to complicate things a lot .. they are REALLY simple:


Maybe I just didn't know enough of them, and I tought they were difficult :)

Unfortunately the physics libraries are out of the equation right now (don't ask why :) )
I managed to knock together a simple rigid body dynamics with tensors.

Anyway, I got your point, and hopefuly will have time on the weekend to try it.
Thanks, again!

#31 kunos   Crossbones+   -  Reputation: 2207

Like
0Likes
Like

Posted 04 October 2012 - 08:45 AM

well if you can't or don't was use 3rd parties physics library that doesn't mean you shouldn't try to learn something from them ;)

Having a solid and well tested RigidBody class with addForce, addForceAtPos, addLocalForceAtPos, addLocalForceAtLocalPos and so on, member functions should be the first step in your simulator development ;)
Stefano Casillo
Lead Programmer
TWITTER: @KunosStefano
AssettoCorsa - netKar PRO - Kunos Simulazioni

#32 bmarci   Members   -  Reputation: 401

Like
0Likes
Like

Posted 04 October 2012 - 09:19 AM

well if you can't or don't was use 3rd parties physics library that doesn't mean you shouldn't try to learn something from them ;)

I used ODE many years ago and tried Bullet recently. Simply it's not a simulator project I'm working with, not even a game, so I don't want to "mess" the codebase, I just use it as a sandbox :)
So as soon as I have "serious" results, a new project prbably with Bullet will be the first thing.

Having a solid and well tested RigidBody class with addForce, addForceAtPos, addLocalForceAtPos, addLocalForceAtLocalPos and so on, member functions should be the first step in your simulator development ;)

Accomplished :P

#33 jujunosuke   Members   -  Reputation: 188

Like
1Likes
Like

Posted 04 October 2012 - 08:24 PM

About suspension and weight transfer, i don't know if the solution i used can help any of you guys.
It is just a simplification of the concept, but honestly, i got pretty decent result and my simulation got better.

As kunos said, i use physX as my physics engine, with 5 rigid body connected with joints.
Basically i calculate the spring compression based on the distance of center of my wheel to the distance of my spring attached to the body of the car.
You can decide about the spring distance free height. I set mine to 0.36 meters.
That mean, if the car body is 0 kg the spring should not be compressed and give you 0.36 meters.

Then i just do some calculation of the distance. Vector3 of the center of the wheel, Vector3 of the joint position.
I then make calculation to get a result between 0 and 1.

0 mean that the spring is stretched to the max and give 0 grip. (spring free height)
1 mean that the spring is compressed to the max and give 100 % of grip.

once you made that, calculate the total force that your tire should provide and multiply it by the result of the spring compression.

Works decently for me and was really simple to implement.
But of course, this technique is valuable only if you use a 3d physics engine as mentioned.

I don't know what kunos think about this way of doing though..

Edited by jujunosuke, 05 October 2012 - 12:30 AM.


#34 Edy   Members   -  Reputation: 134

Like
0Likes
Like

Posted 09 October 2012 - 05:55 AM

At this level, it's all about game and fun with an acceptable level of physical accuracy, and thus as everything in game programming it's all about cheating as much as possible. So there ARE miracle recipes as long as you are not a professional in aero dynamics or in suspension geometry setups.
Later when we work out everything about differentials and tyre simulation those magical solutions will disappear.

I am not even talking about realistic simulation, i am talking about something really simple, the basics.
Beside the fact that marco monster is 10 years old, it cover everything so well, its just the best way to start in my opinion.
And gamedev forum should be there to help you to answer question on a particular point that you don't understand for example.
Of course, its always interesting to see some reading on car physics, a subject that passionate all of us, but the fact of melting all kind of question and answer together make it really confusing and not that easy and enjoyable to read IMO.

Anyhow.. you seem to want to complicate things a lot .. they are REALLY simple:

Having a solid and well tested RigidBody class with addForce, addForceAtPos, addLocalForceAtPos, addLocalForceAtLocalPos and so on, member functions should be the first step in your simulator development ;)


That's exactly my ongoing work: nailing down the basics of vehicle simulation in a way that could be easily understood and used by anyone. Yes, there are really simple ways of doing pretty realistic vehicle simulation. Yes, there are "miracle" recipes, but they are not so miracle, they are just some simple formulas combined in the proper way. And YES, working on differentials, tire simulation, etc could still be simple and comprehensive.

Hopefully a good tutorial should be the result of this work (unless I'm proven terribly wrong Posted Image)

If that is what you mean, then we agree ! Either way, please explain further, the "no calculation" thing.
As all front/lateral forces get eventually multiplied by the wheel load, we can say getting the wheel load right is maybe as much or even more important than getting the initial values right. I had much trouble with that, and honestly for this particular subject i kind of miss examples. When i look at a big pickup truck i can see the springs getting highly compressed. Marcos state something like "xxx acceleration > formula > xxx Fz on back wheels, so you accelerate faster". The fact he didn't talked about car suspesions made me think :
It is not a very important part of the simulation (VERY wrong i think, now)
Suspension or no, i CAN get the force he is talking about, eventually, and maybe suspensions will just make the weight shift process a little slower (i guess it is really wrong too).


No calculation: you set up a vehicle as a rigid body mass suspended on 4 damped springs. If you drop that vehicle from 1m on a surface, it will fall down and when the springs make contact with the surface, they will compress and expand while supporting the mass of the vehicle. Eventually, the damped springs will absorb all the energy and the vehicle will stand still. At this point, the physics engine has done everything for you, you haven't had to code anything yet.

The physics engine allows you to access the 4 contact points with the surface, as well as all related information on each one. This includes the position, normal vector of the surface and the downforce, that is, the force supported by each spring at any time.

Now we start to code. You instruct the physic engine to apply a force to the rigid body of your vehicle in the positions of the contact points (AddForceAtPos). The engine will then simulate the effect of that force at that rigidbody, and what happens when you apply an off-center force on a rigid body? It causes rotation! (torque). The engine will take care of the calculations for simulating that behavior. So imagine that the force you've just applied is located at the contact point of one of the rear springs ("wheel") and is pointing forward. It will cause the rigid body to want to rotate backwards. But the rear springs will counter act this trend by compressing (and thus exerting more force). At the same time, because of the rotation the front springs will expand (exerting less force). Here you have your weight transfer, and all you've done is "AddForceAtPos".

The physics engine gives the downforce on each contact point. So you can use this value for calculating the magnitude of the force you will pass to "AddForceAtPos".

+1. We need some real life values with a known-setup car to help us.


Here are some gems from Kunos (of course ;) ). These real world data are really valuable as they give us a reference of the values we should use and expect to see in the results. Maybe they should go to the first post?

I found a ratio of 1.1 (Fx=Fy * 1.1) is a good starting point.
..
For tyres you are looking into the 200,000 N/m spring rate and a 400 N/ms for damping.
..
It depends a lot.. a typical road tyre will give you 1.0 - 1.1 G.. with load sensitivity and all you should get close to 1.0G on a skidpad. A normal road car with 1.0G lateral acc is considered VERY good (ie. the BMW Mini scores a tad less than 1.0G and is considered a very good handling car).
..
Continuing the grip references, for a high performance road tyre (high end supercars) you see 1.2 - 1.3
Racing slick tyres range from 1.4 to 1.9 depending on compound.
..
The more load on the tyre the more the friction coefficient goes down. A tyre that can do 1.2 at 1000N, might give you 1.1 at 2000N . That is why the loaded tyre will be the first one to "break" grip.



#35 bmarci   Members   -  Reputation: 401

Like
0Likes
Like

Posted 31 October 2012 - 04:46 AM

Hi again,
My hobby car project is going fine, I stepped into the wonderful world of 3d physics :)
Suspension/tire spring/anti-rollbar are complete and seem to work, at least they look good.
The new tire model is not implemented yet, so the car is skating on ice.
Here is a reference video:
No force is applied to the body, only the gravity is acting, the wheels are reacting nicely to banks and the the underlying geometry.
The weight distribution is also fine, the sum of measured suspension forces equal to the mass of the car (in steady state)

Now, I have a concern about the jacking forces.
There are two formulas, Milliken uses the Instant Center and others use Roll Center, but probably the results are the same.

Using a roll center that is below ground a right turn (Fy+) would generate a force acting downward at the left tire, and upward at the right.
If the roll center is above ground the whole thing works the opposite way.

I don't know what to do with that force;
1. Apply it on the car body at the suspension attachment point, so it would push down the chasis at the outside corner, adding more load
2. Add this force to the suspension spring force ???

I just drawn a small figure:
Posted Image

I hope it's self explainary, the length of arrows are not relevant :)

So where does the Fjacking act? (A/B/C ?) or other?

#36 bmarci   Members   -  Reputation: 401

Like
0Likes
Like

Posted 31 October 2012 - 09:48 AM

Another confusion about roll centers, and applied torques:

I though I should have applid forces generated at the contact patch using the car's CG.
But recently I found a couple of writings about roll centers, and the usage of RC instead of CG.

What do I mean, you may ask:
Normaly I calculate body torque using T=BodyRelPos [cross] BodyRelForce
I also found in Racer that Ruud calculates some components of the torque with regard to Roll Center instead of CG.
Lateral jacking?

I'm still far from being clever enough :)

#37 Edy   Members   -  Reputation: 134

Like
0Likes
Like

Posted 23 November 2012 - 11:42 AM

I believe that suspension geometries go far beyond "where this force applies". As far as I can figure out, all forces act on the rigid body at the point they are applied (C in this case, with respect to CG). However, the "intermediate path" and its consequences (i.e. suspension, roll center, etc.) are not easy to calculate. I think it's something related with solving inverse kinematics, unless you are using a physics engine allowing "hard" joints and constraints. In this case you would just apply the force to the wheel's attachment point and the engine would properly propagate it to the rigid body. Again, these are my thoughts, I have no real experience with this.

Edited by Edy, 23 November 2012 - 11:43 AM.


#38 bmarci   Members   -  Reputation: 401

Like
0Likes
Like

Posted 28 November 2012 - 04:04 AM

Thanks Edy,
I tought of C too, but whatever I do, without adding this jacking force everything seems buch better, so I just abandon it for now.
The biggest problem is my "good" old instability problem came back, namely it's hard to take a corner over 50-60km/h.
Too much understeer, maybe I have a crappy steering and that causes the tires to loose traction.




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