Vehicle Docs?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
jgustafsson
Posts: 2
Joined: Thu Oct 01, 2009 5:50 pm

Vehicle Docs?

Post by jgustafsson »

Hi, Are there any vehicle docs available because I cant get a grip on the various parameters available and what they do... for example:

Tire Grip, Rolling Friction, Sliding Friction, Here I expect all parameters should be in the [0, 1] range, but that will not produce any good results, i.e. the car will not move unless I use much higher values. For me only [0, 1] values makes any sense.

Suspension Length, a lower value seem to not only affect the 'ride height' but will actually make the car much slower, if I set this value to low the car will not accelerate at all, why is this? How does the suspension height affect the cards velocity/acceleration?

Suspension Stiffness, again I would expect this value go between (0, 1) where 0 would mean the suspension would just collapse and 1 would mean totaly rigid, causing the simulation to explode. However only values about 10 - 100 seems to do anything in my case, and the LOWER the value the 'softer' the springs, what are good values here?

How do Vehicle.Accelerate() actually work? It says it takes the acceleration value as m/s^2, but setting this to for instance "10" will not cause the car to increase its velocity with 10 m/s (or 40 m/s considering I have 4 wheels?) I have a very ridiculous value like 100000 right now because otherwise the acceleration is so slow...

As an example, setting rolling friction to 0, sliding to 0, grip to 1 I would presume the car would recieve 100% of the acceleration value since theres no friction to stop the car and the grip is "total grip" but this is not the case so what algorithm should I use here?

PS: I have set the wheels to only use their own friction by using the "BEPUphysics.Vehicle.WheelFrictionTypes.ignoreGroundFriction", this way I'm sure the actual values are the ones from my car setup...

I'm getting a feeling I should use the cars weight as some factor when setting the values? I.e. grip == 1 only works when mass == 1
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle Docs?

Post by Norbo »

Sorry, there's no good complete documentation on the vehicle yet. The vehicle is probably going to be changed up in the next few versions as well to make it a bit more straightforward (and powerful).
Tire Grip, Rolling Friction, Sliding Friction, Here I expect all parameters should be in the [0, 1] range, but that will not produce any good results, i.e. the car will not move unless I use much higher values. For me only [0, 1] values makes any sense.
Coefficients of friction are not bound to the range [0, 1] in real life; consider rubber on concrete which can have a coefficient of up to 4. Keep in mind that the computation of the friction force is based on the equation Friction = Coefficient * Normal force.
Suspension Length, a lower value seem to not only affect the 'ride height' but will actually make the car much slower, if I set this value to low the car will not accelerate at all, why is this? How does the suspension height affect the cards velocity/acceleration?
It sounds like the wheels are too far into the car. The car bottom is likely hitting the ground and keep in mind that the grip friction is based on normal force. If the spring can't compress because the wheels are only slightly exposed to begin with, they will never exert enough force to get the car moving. Obviously if the wheels are fully inside the car, you can't get any support :)
Suspension Stiffness, again I would expect this value go between (0, 1) where 0 would mean the suspension would just collapse and 1 would mean totaly rigid, causing the simulation to explode. However only values about 10 - 100 seems to do anything in my case, and the LOWER the value the 'softer' the springs, what are good values here?
This value is a spring constant. A low spring constant means the spring is weaker, high means stiffer. This is like Hooke's Law. For a heavier car, you'll need stiffer springs to get the same appearance as weaker springs and a lighter car.
How do Vehicle.Accelerate() actually work? It says it takes the acceleration value as m/s^2, but setting this to for instance "10" will not cause the car to increase its velocity with 10 m/s (or 40 m/s considering I have 4 wheels?) I have a very ridiculous value like 100000 right now because otherwise the acceleration is so slow...
Remember the Grip coefficient of friction you chose. The limit for your car's drive force is defined by F = gripCoefficient * normal force. By telling the car to accelerate "100000," you're basically spinning the wheels but not getting any traction.

A good place to start with configuring a vehicle is the demos vehicle (in Alternate Movement/VehicleInput.cs). This car drives a bit like a large sedan. For another example designed for a go-kart, check this thread: http://www.bepu-games.com/forums/viewto ... it=go+kart.
jgustafsson
Posts: 2
Joined: Thu Oct 01, 2009 5:50 pm

Re: Vehicle Docs?

Post by jgustafsson »

Thanks, when you mean normal force are you talking about the force the spring is pushing the wheels into the ground? That would explain why a looser spring results in a slower car.

I have experimented alot and using the cars mass as a factor in most numbers seems to be a good rule, I have one major problem however if I accelerate and turn the car will turn nicely but if I release the gas and just roll along the car will almost not turn at all, why is this and how can I combat it?

For your reference here is my current setup and I use 5 m/s^2 as the acceleration value:

float wheelRadius = 0.3f;
float wheelWidth = .20f;
float suspensionLength = 0.25f;
float suspensionStiffness = 25f;
float slidingFriction = 0.12f;
float rollingFriction = 0.08f;
float grip = 20f;
float maxSuspensionForce = 10000.0f;
float suspensionDamping = 0.95f;
float mass = 10.0f;

Vector3 cmOffset = new Vector3(0, -0.4f, 0.1f);

// relative geomatric center
float wheelBaseFront = 1.25f;
float wheelBaseRear = 1.15f;
float wheelBaseWidth = 1.4f;
float wheelBaseheight = 0.3f;
User avatar
Zukarakox
Not a Site Admin
Posts: 426
Joined: Mon Jul 10, 2006 4:28 am

Re: Vehicle Docs?

Post by Zukarakox »

It looks like your sliding friction is set too low. Your car moves properly while accelerating because the acceleration is directed where you are turning and the grip of the wheels against the ground is enough to turn the car. However, when you stop accelerating and attempt to turn, the engine uses sliding friction instead of grip. Your sliding friction needs to be high enough to direct the car, which, in the demos, is 0.8.

For your first question, the normal force is the force directing the wheels into the ground, also called the support force for vehicles.
i has multiple toes
mattbettcher
Posts: 7
Joined: Sun Mar 08, 2009 12:51 am

Re: Vehicle Docs?

Post by mattbettcher »

Norbo - When you upgrade the vehicle class please add the ability to change each wheels direction/velocity. I am looking to create a tank game and I had to create to separate vehicles and attach them together to create my prototype. It was a pain in the ass to get it working decently and definitely inefficient.

Thanks for such a great engine. Keep up the great work.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Vehicle Docs?

Post by Norbo »

Just to make sure I understand, what specific functionality would there need to be other than the existing Wheel.wheelFacingAngle and individual Wheel.acceleration fields? Thanks for the suggestion.

Right now, my largest concern with the vehicle/wheel system is its mess of fields and properties. It's hard to find things and even harder to know what they do. The next vehicle needs to make things as close to immediately obvious as possible.
Post Reply