x


Pc to android conversion (input),Unity3D input conversion

hello i have a game done with unity on pc/mac standalone how can i manage to convert the mouse/keyboard input into touch based sens and add an accelerometer to the game... all i want is to play it on android smart phone i have unity pro trial for now. the game is an fps shooter game ty

more ▼

asked Feb 05 '12 at 02:15 AM

vurama gravatar image

vurama
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

The people at Unity have done a lot to make it easy to convert your PC game to a mobile game. But, obviously it can't convert input by default. So, the simplest way to replicate a two joystick FPS controller is to do the following:

  1. Create two controller prefabs. Unity includes these in the mobile standard assists.
  2. Edit your movement code to respond to joystick.input instead of keystrokes and mouse movements.
  3. There is a standard 2-joystick controller included in the mobile standard assets. If you want a real easy solution, I might recommend that rig and just adding your scripts to it.

Responding to finger drags is as easy as responding to touch.deltaPosition when you move.

And then there's the accelerometer. This depends on how the device is oriented, but basically taking the atan of the various different accelerometer positions with respect to the other 2 will tell you the current angle of the device.

And finally don't forget that you can use conditional compilation to make cross-platform development easier:

#if UNITY_IPHONE
///Do stuff
#endif
more ▼

answered Feb 05 '12 at 03:02 AM

Peter G gravatar image

Peter G
15.1k 16 44 137

Thanks for the tip.

Aug 08 '12 at 08:54 PM alee26
(comments are locked)
10|3000 characters needed characters left

hey thx for the info i did it as u mentioned still have some compiler error trying to fix but i guess i solved the axis issue and input issue and working on compressing the graphic quality to work on my smartphone... ill keep this thread updated tx again

more ▼

answered Feb 05 '12 at 11:06 AM

vurama gravatar image

vurama
1 1 1 1

hey dude...Did you done it perfectly?,,,because me too I want to develop a android game....and do it also first in pc because im not really familiar in android flatform......I'm A nebie in unity....

Thanks in advance dude....hope you will reply

Jun 25 '12 at 12:44 PM winresh
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2614
x982
x606
x143
x72

asked: Feb 05 '12 at 02:15 AM

Seen: 3953 times

Last Updated: Aug 08 '12 at 08:54 PM