Physics
hardcore tweaking
Even
more low-level than the car's basic physics is the way Racer interprets
these. |
|
[This is an OLD text and may not apply anymore to current Racer versions]
Underneath the hood, there are some things which you can edit
easily in Racer that really change behavior at a much lower level than any of
the general physics (car.ini files).
In debug.ini, there are a couple of tweakable options.
Note that the bounciness of the car chassis is set in the car.ini files itself
(per car). Note these are used for ODE (the rigid body library).
- collision.mu; the
friction coefficient for car-track collisions. Try 0.1 for a reasonable default
value. The more friction, the more the car will slow down when touching things.
May be set per surface in the future though.
- collision.cfm; this
is Constraint Force Mixing. Valid values range from 0..1. Do NOT use negative
values. This can be used to make track polygons softer. A default value of
about 0.0001 will give quite hard surface. Try 0.1 and see how spungy the
surfaces become (note your tires may cross the polygons and have a hard time
dealing with outer space, and how you can drive THROUGH polygons at high speed
even). This parameter is used mostly in case the car 'explodes', meaning it
begins to rotate at high speeds, due to overly high corrective constraint
forces.
- collision.erp; this
is the Error Reduction Parameter. As a car enters track objects, some interpenetration
is allowed. The car is, however, pushed back in these situations to move out
of the track object(s). The speed at which this is done is defined by the
ERP; at 0, no corrective action is taken (bad), at 1, the complete error will
be fixed in a single simulation step. Although the latter sounds perfect,
in practice it is best to use a value well below 1 (values between 0.1 and
0.8 are recommended, with a default value of 0.2) for better numerical stability
(less explosive behavior).
In debug.ini, you can find many options. Most of them
I use while developing to be able to do slomo's to really get a good look at
the numbers. There are some fun settings though you might want to experiment
with.
- car.apply_friction_circle;
if set to 1 (by default it is), the will apply a circle to the forces that
the tire generates. A tire is limited to a maximum force, which is independent
of direction. Still, most tire models (like Pacejka, which I'm using) prefer
to handle longitudinal and lateral forces apart, and do some afterthought-like
combining later on. This is to avoid exceeding the tire's friction circle,
which is a concept that at maximum lateral force for example, you can't at
the same time have maximum longitudinal force.
With this setting you can turn it off. Just for testing, I would never do
it for real racing.
- car.friction_circle_method; an important
one. This decides exactly HOW the tire forces should be combined. Method 0
is from Giancarlo Genta's book (see the Credits & Refs page), which uses
a simple elliptic approach. It tops off lateral forces when the longitudinal
forces get too large, basically. So it prefers longitudinal forces, not lateral
ones. Results in perfect ellipses, but not too realistic at the limit.
Method 1 is a vector trimming operation; when the vector length of the lat+long
forces exceed the maximum tire force, both forces are reduced in sync to fit
the circle. Gives somewhat better grip, and you might like it.
Method 2 is a null operation; just leaves the forces as they are. Good for
comparison with the other methods, so you can feel what it is like if no circle
is applied. May be the same as setting 'car.apply_friction_circle' to 0.
Method 3 was invented by Gregor Veble and Brian Beckman, both independently,
so there must be something to it! ;-) This method also modfies the input to
the Pacejka formulae, and then changes these according to the ratio of slip
in longitudinal and lateral directions. It is found to feel much better, and
is the default in Racer v0.4.7.
- car.wheel_lock_adjust; if 1,
this will gradually change the tire force direction to -slipVelocity when
the wheel gets locked. This is done to simulate the fact that with locking
front wheels you can't steer. Set it to 0 and you WILL be able to steer somewhat.
- car.use_slip2fc; if set to
1, this will reduce the friction based on a file (slip2fc.crv), which in turn
is based on slip velocity. The idea is, the more slip velocity, the worse
the friction. This was built in to get the car to do doughnuts, but other
bugs were found and this became obsolete (but is still mostly in there). The
tire forces now take care of this effect.
- car.max_force/torque;
these two define the maximum forces and torques that will be applied to the
car. Previously, some bad situations could make the car go very wild and the
numbers would go to infinity and the program would grind to a halt. So these
max figures keep the car from doing all too wild stuff (hopefully).
Check out the other options in debug.ini; most are mainly
of interest while debugging though.
(last
updated
February 28, 2013
)