Question by 
               The_Pied_Shadow · Nov 17, 2017 at 03:31 PM · 
                inputcontrolleraxis  
              
 
              Using an input axis to change a float
This seems like a noob thing but my searches aren't bringing up anything. Here's my code.
 float mZforce, mZ;
 public GameObject my; //set in inspector
 
 void Update () 
 {
         mZforce += Input.GetAxis("RightTrigger");
         mZ += mZforce;
 
         my.transform.position = new Vector3(0, 0, mZ);
 
         print("mZ = " + mZ);
         print("Trigger " + Input.GetAxis("RightTrigger"));
    }
 
               What I don't understand is that in my console window, mZ doesn't change from 0. However, the Right Trigger axis does change its value. I don't understand how that's possible. According to my code, if the Right Trigger value changes so should mZforce and thus mZ. What am I missing here?
P.S. First time trying to use a Xbox controller for input with unity.
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Huge drift Issue with xbox controllers. 0 Answers
DualShock 4 Horizontal axis stuck on -1 0 Answers
Joystick 3rd Axis problem on Linux 0 Answers