- Home /
Unity iPhone Roll a Ball Tutorial. Joystick example?
I've been looking through the fairly simply Unity Roll a Ball example project, and I was wondering if it included an example of joystick control. Joystick setup is referenced in the 'Controller' script, but I'm not sure if it is implemented in the project. If not, can someone suggest a basic joystick tutorial or example project? Thanks
Answer by $$anonymous$$ · Aug 04, 2012 at 11:00 AM
The joystick input instead of iPhone accelerometer input in the 'Controller' script does not refer to another script or anything. It simply says if you do not wish to use the accelerometer control use Input.GetAxis("Horizontal");
and Input.GetAxis("Vertical");
Which basically means you can control the game using the arrow keys or wasd keys. Unity actually maps these "Horizontal" and "Vertical" to an array of user input devices. So that you don't have to change anything if you want to use an actual physical Joystick instead of the keyboard.
You can see this if you go to Edit->Project Settings->Input. For instance you can change the "Horizontal" axis to be trigger from keys 'zx' instead of 'ad' keys, just in here and without touching the code it still would work.
how would I make it accept input from the keyboard? Right now it's only taking input from the unity remote for iOS
never$$anonymous$$d, found it. simulateAccelerometer:boolean