Vehicles have a tendency to move on their own when they are stopped, due
to their interactions with other surfaces that result in a non-zero
velocity.
Since we have a threshold with the isStopped() method, fix this situation
by setting the linear velocity and wheels rotation (that otherwise also
rotate on their own) to zero vectors.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
A constant friction slip for all vehicles does not seem to work very
well and most are rather hard to steer with. This introduces a somewhat
empirical formula to get a rather sane friction slip value based on
handling data, where coefficients are used in a way compatible with the
required friction slip value for most vehicles.
This is by far not a perfect approach and the steering on some vehicles
still feels out of line with the realistic expected behaviour, but most
remain fairly drivable.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
The current roll influence value makes it much too easy to flip vehicles
upside down. More generally, the vehicles tend to not stick to the ground
enough as they are too easily moved around when hit with another vehicle.
Reduce the roll influence value for vehicles to make them stick more to
the ground.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This introduces a linear reduction of the engine force when braking is
applied. The division factor increases with the steering angle to
max steering angle ratio, reducing the engine force by a factor of
up to 1.25.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This introduces a coefficient to adapt the nominal engine force to our
physics and ensure that top speed is not reached too fast.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Most vehicles are still slow to start and manoeuvre. For instance, it is
rather hard to precisely park in a parking space. In order to make
vehicles more reactive when starting (either forward or backward), the
engine force is increased at first and progressively decreased to its
nominal force, following the velocity increase up to half the maximum
velocity.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Since heavy vehicles have more inertia, they require more engine force
to be moved sufficiently fast. Without this extra force, many heavy
vehicles are unbearably slow to drive. Reuse the mass coefficient that
was introduced to increase the engine force accordingly.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This implements proper braking by detecting a brake condition with a
negative throttle and a positive forward velocity. Under this condition,
the engine is stopped and brake is applied. A mass coefficient is
introduced to quantify how heavy a vehicle is, so that more braking can
be applied to heavy vehicles, that have higher inertia.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>