Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • GetAxis

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 866
    Answer it

    Hi all im working on a game 2d , i want to make a space game on 2d and i all most did it but the problem is on axis it wont work :( so i need help here is my script in C#

    public float speed = 10;

    void Update() { float translation = Input.GetAxis("Horizontal") * speed; }

 1 Answer(s)

  • Hello

    Input.GetAxis("Horizontal")always use for horizontal axis. It always returns value from -1 to 1 for keyboard.

    It works only when you press Left arrow,Right arrow,Key "A" or Key "D" on keyboard for moving an object either left or right.

    Thanks!!
    I hope you will get help from this.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: