Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Going backwards makes input going forwards on MP4 #30

Open
GreepTheSheep opened this issue Sep 17, 2021 · 7 comments
Open

Going backwards makes input going forwards on MP4 #30

GreepTheSheep opened this issue Sep 17, 2021 · 7 comments

Comments

@GreepTheSheep
Copy link

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

@codecat
Copy link
Owner

codecat commented Sep 17, 2021

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

@skybaks
Copy link
Contributor

skybaks commented Sep 19, 2021

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

@codecat
Copy link
Owner

codecat commented Sep 19, 2021

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

@skybaks
Copy link
Contributor

skybaks commented Sep 20, 2021

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.

@codecat
Copy link
Owner

codecat commented Sep 20, 2021

Ah, yes you are right.

@Atheuz
Copy link
Contributor

Atheuz commented Sep 22, 2021

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.

@Phlarx
Copy link

Phlarx commented Nov 7, 2021

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants