Coming soon - Get a detailed view of why an account is flagged as spam!
view details
0
How to script for Joystick analogue​ trigger release?
Post Body

I am working in CSharp.

I am adding joystick control to my game.

As people may know the 3rd axis controls the trigger buttons on a Xbox Joystick.

A value between 0 & 1 is the right side trigger button. A value between -1 & 0 is the left side trigger button.

I wish to use the player releasing the right side trigger button as an input for the game i.e. if the 3rd axis returns a value of <1. The game should register that the player has let go of the right trigger.

The problem is that if the player uses the left trigger. It also registers as the player releasing the right trigger. Because pressing the left trigger returns a value of -1 which is also <1.

I'm assuming that I need to use a system of checking the range of the value and Boolean variables to measure whether either trigger has already been pressed. But I have no idea how to express that in code.

Any help?

Author
Account Strength
100%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
12,245
Link Karma
7,043
Comment Karma
5,012
Profile updated: 23 hours ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago