Always smooth turning.

It fixes turning for non-analog gamepads and gives more consistency for online gaming, because you can't turn fully left/rigtht immediately with analog controllers. Should be better for android too, because it's kinda less sensitive.
This commit is contained in:
Deve 2018-12-19 22:49:15 +01:00
parent 3dffb6c480
commit f3ef25d525

View File

@ -285,19 +285,13 @@ void PlayerController::steer(int ticks, int steer_val)
: dt/m_kart->getTimeFullSteer(fabsf(steer));
if (steer_val < 0)
{
// If we got analog values do not cumulate.
if (steer_val > -32767)
steer = -steer_val/32767.0f;
else
steer += STEER_CHANGE;
steer += STEER_CHANGE;
steer = std::min(steer, -steer_val/32767.0f);
}
else if(steer_val > 0)
{
// If we got analog values do not cumulate.
if (steer_val < 32767)
steer = -steer_val/32767.0f;
else
steer -= STEER_CHANGE;
steer -= STEER_CHANGE;
steer = std::max(steer, -steer_val/32767.0f);
}
else
{ // no key is pressed