Avoid flicker when a kart with backpedal animation is stopping and
left/right is pressed (see #2939).
This commit is contained in:
parent
c8d13d7360
commit
d7f5fb9e69
@ -1616,7 +1616,11 @@ void Kart::updateSpeed()
|
||||
chassisTrans.getBasis()[1][2],
|
||||
chassisTrans.getBasis()[2][2]);
|
||||
|
||||
if (forwardW.dot(getVehicle()->getRigidBody()->getLinearVelocity()) < btScalar(0.))
|
||||
// In theory <0 should be sufficient, but floating point errors can cause
|
||||
// flipping from +eps to -eps and back, resulting in animation flickering
|
||||
// if the kart has backpedal animations.
|
||||
if (forwardW.dot(getVehicle()->getRigidBody()->getLinearVelocity())
|
||||
< btScalar(-0.01f))
|
||||
{
|
||||
m_speed = -m_speed;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user