Fix behavior when no acceleration/braking above the "stop" speed limit
The kart accelerating when going backwards was a sign issue (missing fabsf) and was already fixed in bb1aac3857
Setting the engine force to 0 in all cases causes issues when not accelerating/braking at higher speeds.
This commit is contained in:
parent
f4b02c096a
commit
cc1f2f63b9
@ -2798,15 +2798,22 @@ void Kart::updateEnginePowerAndBrakes(int ticks)
|
||||
// lift the foot from throttle, let friction slow it down
|
||||
assert(!std::isnan(m_controls.getAccel()));
|
||||
assert(!std::isnan(engine_power));
|
||||
// Engine must be 0, otherwise braking is not used at all
|
||||
applyEngineForce(0);
|
||||
|
||||
// If not giving power (forward or reverse gear), and speed is low
|
||||
// we are "parking" the kart, so in battle mode we can ambush people
|
||||
if (std::abs(m_speed) < 5.0f)
|
||||
{
|
||||
// Engine must be 0, otherwise braking is not used at all
|
||||
applyEngineForce(0);
|
||||
m_vehicle->setAllBrakes(20.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This ensure that parachute and air friction are applied
|
||||
// and that the kart gracefully slows down
|
||||
applyEngineForce(engine_power-braking_power);
|
||||
m_vehicle->setAllBrakes(0);
|
||||
}
|
||||
} // no braking and no acceleration
|
||||
} // not accelerating
|
||||
} // updateEnginePowerAndBrakes
|
||||
|
Loading…
Reference in New Issue
Block a user