Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by vurama · Feb 05, 2012 at 02:15 AM · androidinputtouchaccelerometerconversion

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Peter G · Feb 05, 2012 at 03:02 AM

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
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alee26 · Aug 08, 2012 at 08:54 PM 0
Share

Thanks for the tip.

avatar image winkan · Aug 10, 2013 at 08:33 PM 0
Share

Thank you Peter, this will help to me.

avatar image
0

Answer by vurama · Feb 05, 2012 at 11:06 AM

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image winresh · Jun 25, 2012 at 12:44 PM 0
Share

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

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Joypad help 0 Answers

How to add Jump control from touch on screen? ANDROID 1 Answer

Please confirm: Galaxy Stylus not readable directly in Unity 1 Answer

How to differentiate touches on mobile devices 1 Answer

Onscreen fire button for FPS games. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges