Try to bring karts quicker back on the ground when the kart is

on its side, without overcompensating (and therefore shaking)
when the kart is only slightly non-parallel to the ground
when flying.
This commit is contained in:
hiker 2015-08-05 17:00:40 +10:00
parent f36672c104
commit b44f0605dc
2 changed files with 6 additions and 3 deletions

View File

@ -426,7 +426,7 @@
chassis-angular-damping="0"
downward-impulse-factor="5"
track-connection-accel="2"
smooth-flying-impulse="25"/>
smooth-flying-impulse="250"/>
<!-- collision
impulse-type: STK can apply an additional impulse in case of

View File

@ -446,9 +446,12 @@ void btKart::updateVehicle( btScalar step )
{
btVector3 kart_up = getChassisWorldTransform().getBasis().getColumn(1);
btVector3 terrain_up(0,1,0);
// Length of axis depends on the angle - i.e. the further awat
// the kart is from being upright, the larger the applied impulse
// will be, resulting in fast changes when the kart is on its
// side, but not overcompensating (and therefore shaking) when
// the kart is not much away from being upright.
btVector3 axis = kart_up.cross(terrain_up);
if(!axis.fuzzyZero())
axis.normalize();
// To avoid the kart going backwards/forwards (or rolling sideways),
// set the pitch/roll to 0 before applying the 'straightening' impulse.