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

detect return to center on axis #11

Open
arendeutsch opened this issue Oct 1, 2020 · 3 comments
Open

detect return to center on axis #11

arendeutsch opened this issue Oct 1, 2020 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@arendeutsch
Copy link

Hello,
Is it possible to detect return to center on analog stick ?

@ArunMichaelDsouza
Copy link
Owner

Hi @arendeutsch,

You can check for the axisMovementValue parameter returned from the axis_move event. This will give you the value of the axis movement. The center would be close to 0.

joypad.on('axis_move', e => {
  console.log(e.detail.axisMovementValue);
});

Please note some older/used controllers might not go all the way to 0.

@arendeutsch
Copy link
Author

Yes, im not sure it happens,
When you release the analog stick you dont get an event fire up when it closed to zero.
If i pull one of the stick all the way which give 1 or -1 and release then i might give 0.8 or 0.9 but not close to zero

@ArunMichaelDsouza
Copy link
Owner

Yes, that is correct. No event is fired when the stick value comes close to zero. Will have to look into this.

@ArunMichaelDsouza ArunMichaelDsouza added enhancement New feature or request good first issue Good for newcomers labels Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants