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
1
Question by hirenkacha · Apr 04, 2012 at 05:54 PM · androidinput

How can I define Android or iOS inputs?

instead of Input.GetAxis("Vertical")*moveVec; what should I use for android? and also for Input.GetAxis("Horizontal") please let me know.

I want to use a simple touch on screen for moving forward. and also want to use mobile's motion to turn left and right.

If any better option then this, then also please let me know.

Thanks in advance.

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

3 Replies

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

Answer by hirenkacha · Apr 05, 2012 at 07:46 AM

I have got the solution for my game, i am using this code to move forward when touched the screen and stop when released the screen.

if(Input.GetTouch(0).phase==TouchPhase.Stationary)

{

  transform = moveVector * Input.touchCount;

}

else

{

  transform = moveVector * 0;

}

Thanx for replying and giving me an idea.

Comment
Add comment · 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
1

Answer by SirGive · Apr 04, 2012 at 06:11 PM

You have to either calculate touch offsets using a delta position or use an onscreen joystick. You also have to catch the device's acelorometer or gyro to detect turning motion. Here is a pretty good example for detecting touch.

Comment
Add comment · Show 5 · 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 hirenkacha · Apr 05, 2012 at 05:26 AM 0
Share

thanx.. it really helpd me.. now m looking forward for turning motion.

avatar image hirenkacha · Apr 07, 2012 at 03:28 PM 0
Share

accelerometer also done...

avatar image hirenkacha · Apr 16, 2012 at 11:51 AM 0
Share

if any one need accelerometer comment here... i will post it..

avatar image kevinseligmann · Jun 04, 2012 at 03:48 PM 0
Share

I do, are you still offering your help @hirenkacha ?

avatar image hirenkacha · Jun 05, 2012 at 04:09 AM 0
Share

yeah sure why not..??

avatar image
0

Answer by hirenkacha · Jun 05, 2012 at 04:16 AM

If you want your car to move according to device tilt, use this

 FrontLeftWheel.steerAngle = 20 * Input.acceleration.y; /* you can use any number instead of 20 for sensitivity. FrontLeftwheel is the wheel collider attached to front wheels. .y is for landscape orientation.
 FrontRightWheel.steerAngle = 20 * Input.acceleration.y;
Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

,How Do get Touch input to work with the Player Input Component 1 Answer

Input.GetTouch(0).tapCount question 2 Answers

TouchInput doesn't not exist in current content 0 Answers

Detect Gyroscope's rotation around a single axis? Like a car game. 0 Answers

Android: Touch Input Timeout Issue 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