Strange vehicle behaviour when braking

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Strange vehicle behaviour when braking

Post by lazy »

hi

When I drive my vehicle forward and brake, the cars front part is lifted from the ground. ( usually I would excpet the front part being pushed against the ground? )
And when I drive backwards the backpart lifts upp.

Oh yeah... is the cars forward supped to be -z ?

I've inculded and ugly illustration. The arrows are the velocity direction when breaking.

Maybe some of my settings are weird?

Vector3 SUSPENSION_DIRECTION = new Vector3(0, -1, 0);
Vector3 FORWARD_VECTOR = new Vector3(0, 0, 1);
float WHEEL_RADIUS = 0.5f;
float WHEEL_WIDTH = 0.4f; //What does this affect?
float SUSPENSION_LENGTH = 1.0f;
float SUSPENSION_CONSTANT = 80; //Don't know what this does :P
float SLIDING_FRICTION = 20f; // I want no sliding
float ROLL_FRICTION = 0.5f; // I Want the car to stop fast if I'm not accelerating
float GRIP = 5.5f;
float MAX_SUSPENSION_FORCE = 2500;
float SUSPENSION_DAMP = 0.92f;
Attachments
illustration.jpg
illustration.jpg (36.77 KiB) Viewed 3242 times
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange vehicle behaviour when braking

Post by Norbo »

The 'reverse tilting' is most likely caused by a center of mass which is below the wheels. See if you assign a center of mass offset anywhere; changing it can help stability, though if it gets too far down you will see things like that.

The forward vector will be -z, yes. This is due to a conventions choice in XNA.

I'm a little short on time right now, but these threads might help with the general 'what each parameter means':
http://www.bepu-games.com/forums/viewto ... 664&p=5036
http://www.bepu-games.com/forums/viewto ... ?f=4&t=374
lazy
Posts: 26
Joined: Tue Dec 08, 2009 2:56 pm
Location: stockholm, Sweden
Contact:

Re: Strange vehicle behaviour when braking

Post by lazy »

Ah yes. The center of gravity was offseted downwards. Now it looks better =)

Instead I increased the gravity to -30 so the car wouldn't flip over. Is there any problem with having such a high gravity value?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Strange vehicle behaviour when braking

Post by Norbo »

-30 will probably be okay. Your cars are pretty big compared to a gravity of -9.81, so increasing it may feel more right in general. Increasing gravity can cause issues with some systems (similar to the effects you might see if you increased the time step duration or shrank all objects), but it should take more than a factor of 3 to show up.
Post Reply