Hello, I have just finished making my first game in unity, which is based off a few tutorials. I am trying to convert this game into an iPhone game. The finger nicely replaces the mouse. However, the keyboard controls cannot be converted. The game is a top down strategy based game made using sprites (Sorry if i am not technically correct, after all i am a newbie ) Hence, i cannot use any of the control setups that come with unity iPhone. Could you please help me or point me to the direction where i can learn how to create a basic joystick/accelerometer control which overrides the W,A,S,D controls. The problem is that the script from the tutorial was made in c#. Hence, i need a script through which i can override the normal keyboard controls to either joystick/accelerometer. Thank you in advance for all your help. Any help in this context will be greatly appreciated. UPDATE: Have kind of got it working please see below for more details
Wow ! nobody. Okay just an update tried all the scripts that come with the iPhone standard assets. After a lot of playing around got some of them working. But very very buggy. Then tried the accelerometer script in the manual. It worked flawlessly with Unity Remote but after building and running the app i realized that the users will have to keep their Phones/iPads(Worked Better) flat on a surface and then play. is there anyway i can just move up down right left more easily ?
K so the accelerometer is finally moving after i used the following script. Code (csharp): var speed = 10.0; function Update () { var dir : Vector3 = Vector3.zero; dir.x = -iPhoneInput.acceleration.y; dir.z = iPhoneInput.acceleration.x; if (dir.sqrMagnitude > 1) dir.Normalize(); dir *= Time.deltaTime; transform.Translate (dir * speed, Space.World); } Now the problem is as follows :- If i hold the device parallel to the ground with the home button on the right hand. The player moves as follows:- Right(Home Button) becomes up Left becomes down Up becomes left and Down becomes right. How can i fix this? Thanks in advance.
The iPhone example projects have good examples that should help you. I think one has virtual joysticks, but cannot be certain without downloading the projects. http://unity3d.com/support/resources/example-projects/iphone-examples
why didnt u try it by changing the Player Settings?? wer u can set it as Landscape mode of playing ie In Unity Menu:: Edit--> Project Setting--> Player--> Default Screen Orientation--> <<set it to wat ever u like>> u have 4 option on it.