• 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
2
Question by CallToAdventure · Apr 18, 2011 at 01:57 PM · cartanksetuptrackturn

Tank wheels control

Hi everyone,

I want to use a very simple car setup with wheel coliders but the steering should be done by stopping (or reversing) the motorTorque of the wheel colliders on one side like an excavator.

I use this to add torque to wheels;

frontWheel.motorTorque = 45 * acc;
backWheel.motorTorque = 45 * acc;

and tried this instead of "steerAngle" from documentation for default car setups:

frontWheel.motorTorque = -40 * Input.GetAxis("Horizontal");
backWheel.motorTorque = -40 * Input.GetAxis("Horizontal");

I don't have to tell you that the behavior is less than expected : )

Also, regarding GetAxis - how do I know when I turn left or right? I'd prefer something mapped on my own keys, since I will have 2 types of turning ~ on the spot, where the vehicle won't move forward and normal turns, left or right, as I drive ahead.

Any hints or references to docs will be much appreciated. Thanks!

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
1
Best Answer

Answer by CallToAdventure · Apr 26, 2011 at 06:27 PM

The solution to this problem cannot be actually done with realistic (copying reality) controls without putting way too much physics at work. A tank has wheels but the traction is done with the, well, tracks (or treads). This part is the trickiest to achieve. Hence, I opted for a simpler solution: use wheels and wheel steering along with custom keys to turn on spot while using UV animation for tracks and simple rotation transforms for wheels matching the speed (actually, the parent's velocity) for a realistic effect. It's a bit of work to set up all wheels (20 for most tanks) and in particular bump/diffuse UV animation needs some digging in the documentation.

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 Jean-Fabre · Apr 18, 2011 at 02:09 PM

Hi,

I would actually use cylinders and control it via a configurable joint and let the friction do the rest.

You can view an example of an excavator, which I think is the same as what you are trying to achieve. and here the related forum thread

It might not be totally how you want to control your system, but could be a good start.

Regards input, you'll have to roll your own algorithm to detect what exactly the user is trying to achieve.

Bye,

Jean

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Help to make tank tracks move 1 Answer

How can I make my car turn? 1 Answer

Why won't my car steer? 1 Answer

Car steering 1 Answer

WheelCollider Setup from car? 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