• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Rapha

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

37 posts in this topic

[quote name='kunos' timestamp='1349329375' post='4986662']
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.
[/quote]

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?
1

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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
1

Share this post


Link to post
Share on other sites
[quote name='kunos' timestamp='1349347427' post='4986713']
Anyhow.. you seem to want to complicate things a lot .. they are REALLY simple:
[/quote]

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!
0

Share this post


Link to post
Share on other sites
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 ;)
0

Share this post


Link to post
Share on other sites
[quote name='kunos' timestamp='1349361931' post='4986777']
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 ;)
[/quote]
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.

[quote name='kunos' timestamp='1349361931' post='4986777']
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 ;)
[/quote]
Accomplished :P
0

Share this post


Link to post
Share on other sites
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
1

Share this post


Link to post
Share on other sites
[quote name='bmarci' timestamp='1349258479' post='4986333']
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.
[/quote][quote name='jujunosuke' timestamp='1349313694' post='4986621']
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.
[/quote]
[quote name='kunos' timestamp='1349347427' post='4986713']
Anyhow.. you seem to want to complicate things a lot .. they are REALLY simple:[/QUOTE][quote name='kunos' timestamp='1349361931' post='4986777']
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 ;)
[/quote]

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 [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img])

[quote name='PochyPoch' timestamp='1349313737' post='4986622']
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).
[/quote]

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".

[quote name='PochyPoch' timestamp='1349313737' post='4986622']
+1. We need some real life values with a known-setup car to help us.
[/quote]

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?

[quote name='kunos']
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.
[/quote]
0

Share this post


Link to post
Share on other sites
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: [url="http://www.youtube.com/watch?v=w-w7lS2oO6A"]http://www.youtube.com/watch?v=w-w7lS2oO6A[/url]
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:
[img]http://www.mascot.hu/jacking.jpg[/img]

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

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

Share this post


Link to post
Share on other sites
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 :)
0

Share this post


Link to post
Share on other sites
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
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0