Search Unity

Moving object with joystic axis

Discussion in 'Scripting' started by Nithel, Feb 24, 2010.

  1. Nithel

    Nithel

    Joined:
    Feb 22, 2010
    Posts:
    9
    Hey there.
    How do I write a script to simply controlling an object with an axis instead of a key?
    I've been using this, but I've hooked up my Xbox 360 joystick and want to some of the axes on it controll my character.
    This is what I used for the buttons. And it's also pretty much all I can do with javascript (so talk to me as a newbie)
    Code (csharp):
    1.     if(Input.GetButton("right")){
    2.         transform.Translate(0.1,0,0);
    I know this is pretty basic stuff, but for some reason I can't find ANYTHING about scripting an axis control.

    Thanks!
    //Nithel
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401