tm-dashboard icon indicating copy to clipboard operation
tm-dashboard copied to clipboard

Going backwards makes input going forwards on MP4

Open GreepTheSheep opened this issue 3 years ago • 7 comments

When I go backwards, the inputs visualizer makes the forward inputs show instead of the backwards

In the example below, the speed viz is negative (meaning it's backwards) but the inputs show forwards image

GreepTheSheep avatar Sep 17 '21 18:09 GreepTheSheep

@Atheuz Perhaps you wanna look into this? (Otherwise I'll check it out later myself haha)

codecat avatar Sep 17 '21 19:09 codecat

It looks to me that InputGasPedal is always positive, but when going in reverse the gear is 0.

skybaks avatar Sep 19 '21 19:09 skybaks

The vehicle velocity itself has little to do with which inputs are pressed, so we can't really check gear value.

codecat avatar Sep 19 '21 20:09 codecat

I'm not sure I completely understand that statement. What I meant to say was that during my observations in TM2 Stadium, the following occurred:

  1. I accelerated forwards by pressing . I observed the up key highlighted on the dashboard
  2. I released the up key and applied the brake by pressing . I observed the down key highlight as I slowed down.
  3. When the car stopped moving forward, the down arrow was no longer highlighted. I am still holding the down arrow on my keyboard.
  4. The car starts to move backward as I continue to hold my down arrow key. I observe that now the Up arrow key is highlighted on the dashboard.

My conclusions from this observation:

  • Down arrow key applies both Reverse and Brake.
  • Reverse and Brake are not the same thing.

skybaks avatar Sep 20 '21 22:09 skybaks

Ah, yes you are right.

codecat avatar Sep 20 '21 23:09 codecat

Braking at positive velocity: braking-positive-velocity

Braking at negative velocity: braking-negative-velocity

Note the InputIsBraking. That is the value that is used to set the backwards key: https://github.com/codecat/tm-dashboard/blob/master/Source/Pads/Keyboard.as#L20 Not really sure how to fix this.

Atheuz avatar Sep 22 '21 15:09 Atheuz

From some experimentation, it appears to me that:

  • if positive velocity:
    • if inputIsBraking and inputGasPedal:
      • up-key and down-key are both pressed
    • if inputIsBraking and not inputGasPedal:
      • down-key is pressed
    • if inputGasPedal:
      • up-key is pressed
  • if negative velocity:
    • if inputIsBraking and inputGasPedal:
      • up-key and down-key are both pressed
    • if inputIsBraking and not inputGasPedal:
      • up-key is pressed
    • if inputGasPedal:
      • down-key is pressed

There seems to be a problematic edge-case near zero speed, which could be fixed if we could replace the car's linear velocity with the wheel's angular velocity for the above conditions. Unfortunately this also requires some threshhold value for mapping inputGasPedal to a bool value, since it changes smoothly.

This observation also predicts that the inversion of this bug would also appear: driving with negative velocity, and then braking with the up-key will be displayed as a down-input. From my testing, this is true (at speeds above when the wheels start spinning).

Phlarx avatar Nov 07 '21 18:11 Phlarx