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 Taliesin · Sep 10, 2013 at 05:56 PM · carwheelcolliderturn

Why won't my car steer?

Hello guys! I can't make my car steer. On the computer it runs ok with those Input.GetAxis, but I can't make it work on the android device. What should I change in this code to make it run on phone? Also what is a substitute for Input.GetAxis for android, because it doesn't seem to be working on phone. Thanks in advance!

     var maxTorque : float = 200;   
     var speed:float=3;    
     var GasTouch : int = 0;
     var Steer : int = 0; 
 
     var BackLeft : WheelCollider;
     var BackRight : WheelCollider;
     var FrontLeft : WheelCollider;
     var FrontRight : WheelCollider;
     
     var LeftButton : GUITexture;
     var RightButton : GUITexture;
     var GasButton : GUITexture;
     var Joystick : GUITexture;
       
     function Awake()
     {    Joystick = GameObject.Find("Joystick").guiTexture;
         LeftButton = GameObject.Find("LeftButton").guiTexture;
         RightButton = GameObject.Find("RightButton").guiTexture;
         GasButton = GameObject.Find("GasButton").guiTexture;
     }    
     function Update()
     {
     BackLeft.motorTorque=-maxTorque * Input.GetAxis("Vertical");
     BackRight.motorTorque=maxTorque * Input.GetAxis("Vertical");
     //FrontLeft.steerAngle=20 * Input.GetAxis("Horizontal");
    // FrontRight.steerAngle=20 * Input.GetAxis("Horizontal");
         
      for (var touch : Touch in Input.touches)
     {
         if (touch.phase == TouchPhase.Stationary && GasButton.HitTest (touch.position))     {
             GasTouch = 1;
         }
         else if (touch.phase == TouchPhase.Ended && GasButton.HitTest) {
             GasTouch = 0;
         }
         if (touch.phase == TouchPhase.Stationary && LeftButton.HitTest (touch.position))     {
         Steer = -1;
         FrontLeft.steerAngle = -15.0;
         FrontRight.steerAngle = -15.0;
     
         }
         else if (touch.phase == TouchPhase.Ended && LeftButton.HitTest){
         Steer = 0;
         FrontLeft.steerAngle = 0;
         FrontRight.steerAngle = 0;
         }
         if (touch.phase == TouchPhase.Stationary && RightButton.HitTest (touch.position)) {
         Steer = 1;
         FrontLeft.steerAngle = 15.0;
         FrontRight.steerAngle = 15.0;
         }
         else if (touch.phase == TouchPhase.Ended && RightButton.HitTest){
         Steer = 0;
         FrontLeft.steerAngle = 0;
         FrontRight.steerAngle = 0;
         }
         
    }
    
    if(GasTouch!=0)
    {
    transform.Translate(Vector3.forward*speed/100);
    }
     
 
Comment
Add comment · Show 1
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 Taliesin · Sep 10, 2013 at 07:31 PM 0
Share

Come on guys, I'm a beginner and I've been stuck on this for two days now.

1 Reply

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

Answer by Benproductions1 · Sep 10, 2013 at 11:45 PM

Hello,

This one link will answer all your questions:
http://lmgtfy.com?q=Unity+Android+Input

Hope this helps,
Benproductions1

Comment
Add comment · Show 3 · 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 meat5000 ♦ · Sep 10, 2013 at 11:48 PM 0
Share

lmgtfy

Love it.

avatar image Taliesin · Sep 11, 2013 at 11:26 AM 0
Share

Yea, well, thank you. $$anonymous$$y native language isn't English so thank you for looking that up for me. I realize now that my question was kind of stupid...

avatar image Benproductions1 · Sep 11, 2013 at 11:30 AM 0
Share

Glad I could help, I hope next time your question won't be answerable by a google link ;)

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

18 People are following this question.

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

Related Questions

How to make car AI using WheelColliders turn exactly 90 degrees? 0 Answers

Wheelcolliders launch the car. 0 Answers

Perfect friction with WheelColliders 1 Answer

How to make a car not slow down while turning? 2 Answers

Car wheel not detecting ground 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