Page 1 of 1

Vibrating car problem

Posted: Tue Dec 29, 2009 11:51 pm
by lazy
My car vibrates when standing still. ( didn't see it until I drew the bounding box. ) . Not sure what can cause it. And the physics simulation takes alot of time now.

The wheels are very big compared to the body size ( w:3, h:2, l:10 )
In the attached image I draw the car bodies bounding box.

I guess some of my suspension settings aren't so good... I also have a very high gravty value ( 0,-30, 0)

these are my wheel settings

Vector3 SUSPENSION_DIRECTION = new Vector3(0, -1, 0);
Vector3 FORWARD_VECTOR = new Vector3(0, 0, 1);
float WHEEL_RADIUS = 1.5f;
float WHEEL_WIDTH = 1.2f;
float SUSPENSION_LENGTH = 1.0f;
float SUSPENSION_CONSTANT = 180;
float SLIDING_FRICTION = 20f;
float ROLL_FRICTION = 0.5f;
float GRIP = 5.5f;
float MAX_SUSPENSION_FORCE = 15000;
float SUSPENSION_DAMP = 0.98f;


thanks!

Re: Vibrating car problem

Posted: Wed Dec 30, 2009 5:10 am
by Norbo
The settings look reasonable at first glance. When did the physics time start going up? How high is it? Can you reproduce it under some circumstances while avoiding it in others? If it's a significant drop in performance, it may be related (though I'm not sure how yet). A quick video might provide useful information.

Re: Vibrating car problem

Posted: Wed Dec 30, 2009 11:34 am
by lazy
It's on the xbox360. So I can't send a video. =(

With one car the simulation time jumps between. ( one frame it can be at min, the next at max and then somewhere inbetween )
max 4.1ms
min 0.1ms
average 2ms

The only thing in the space is my trimesh and the car.

When I have 4 cars the times are
max 19.9ms
min 0.3ms
average 7.9ms

I just use a TimeWatch.
In the image the Red row is the rendering time and the green the physics. ( the light blue is all game update incl. physics )
The brightest part of a row is the min time, the darkest, the max time. and the medium the current time.
The frame I took the image the physics is at it's minimum.
I start the stats when everything looks to be standing still.

I think this started when I rescaled my cars. I gave them bigger wheels and stronger suspension.
I'll try to revert the changes and see what happens.

Re: Vibrating car problem

Posted: Thu Dec 31, 2009 6:48 pm
by Norbo
I was able to spend some time testing out the vehicle with those settings. I wasn't able to replicate the vibration, but the high-end times you measured are about right. If your ground mesh is relatively finely detailed compared to your car so that the car is near quite a few triangles at any given time, it can harm performance. The time it takes to simulate a car goes up almost linearly with the number of triangles nearby.

You can also try reducing the accuracy of the solver a bit by reducing the iterations setting:

Code: Select all

space.simulationSettings.collisionResponse.iterations = 2;
Less iterations makes things less accurate (2 iterations would make it difficult to stack more than a couple of boxes), but it takes less computation.

These times should be pretty consistent, so I'm not sure what's causing the jumpiness in times that you observe. If you're running the engine with internal timestepping, the low-end updates may be the frames where the engine hasn't seen enough time pass to do another timestep.