Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by saabriwa12 · Nov 28, 2017 at 04:46 AM · unity 5car gamewheelsteering

car game unity 5

hi, I want to make the steering wheels of my car rotate left or right according to the movement of the car. Please, I need helps. thanks This is the code of the direction of the car to right or left // Direction du vehicule float DA =(((WheelAngleMax - DAmax) / MaxSpeed) Speed ) + DAmax; front_left.steerAngle = Input.GetAxis("Horizontal") DA; front_right.steerAngle = Input.GetAxis("Horizontal") * DA;

I don't know how to make my steering wheel rotate like the front wheels. I really need helps. I search on the internet and I don't find a tutorial to do it

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Honorsoft · Mar 17, 2018 at 10:13 PM

If you check out the Unity's Standard Assets, there is already a car with turning wheels. To add a turning steering wheel, you don't even have to 'mess' with any of the car controller code or anything like that. Just have a separate object as a steering wheel and then you can just add code to the car script that turns the wheel object according to the steering input. What I mean is, the car's wheels are being turned already by Unity's code according to Input by the player, you just want to add a line of code (or two) that rotates the steering-wheel object also (on the Z-axis I think). You could add your code to the CarUserControl.cs script or on the CarController.cs script or just add a script to the SteeringWheel object that checks the horizontal input for it self and rotates itself sccordingly. For example, the CrossPlatformInputManager.GetAxis("Horizontal") is used to turn the tires between -25 and 25 on the Y axis. That is for front wheels (SkyCarWheelFrontLeft and SkyCarWheelFrontLeft in the Heirarchy). I have to study this more too, I am currently adding vehicles to my MMORPG, but it looks like the CarUserControl.cs script checks the player input, and then calls a Move function that resides in the CarController.cs script. (See Maximum Steer Angle in the CarController in the Inspector).

You want to add a MaxTurnAngle variable for your steering wheel (50 looks right to me instead of 25 like the wheels), making sure your SteeringWheel has the correct starting orientation (X-Right,Y-Up,Z-Forward). Then either adjust it's Z rotation according to the player's horizontal (Left and Right) input directly, or you could use Unity's float CurrentSteerAngle X 2 and apply that amount to the Z rotation of the SteeringWheel.

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

193 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 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 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 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 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 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 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 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 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 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 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 can I make the character rotating the steering wheel inside the car? 0 Answers

Logitech Steering Wheel g920 does not work on PCs but on Laptops 0 Answers

how can i make a steering wheel and brake and move button for mobile?? plessss any one,how can i make a steering wheel and brake and move button for a car for mobile ?? pleseeee any one 0 Answers

Unity 5 Car accident 0 Answers

Clamping the rotation of the steering wheel 0 Answers


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