Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by Jeremiah · Feb 16, 2010 at 10:30 AM · physicsvehicletankwheelswheel-collider

Implement a vehicle that can "turn on the spot".

I have been working on a prototype game with tanks. I'm currently working on getting the motion of the tank working correctly. At the moment, the forward and reverse movement is working (reasonably well) using basic vehicle physics with 4 wheel colliders, but one of the features of a tank is that it can "turn on the spot" by rotating its "treads" in opposite directions. This is where I am having trouble.

My initial attempt was to apply a motor torque on the left wheels in the opposite direction as the right wheels but apparently, the forces just cancel eachother out and the tank doesn't move.

I've also tried to apply a angular torque to the tank's main body's rigid body, but the tank doesn't seem to rotate smoothly (I suppose it has something to do with the wheel colliders preventing the tank from moving sideways?)

Another option might be (but I havn't tried this) to just rotate the tank's transform directly. I wan't to avoid this because as far as I know, this doesn't play nicley with the physics engine. Perhaps it works if the tank is sitting on a flat surface, but if it's on rough terrain, I might run into some problems.

What I also want to try is to turn the WheelColliders 90 degrees (so front wheels turn +90 degrees and the back wheels turn -90 degrees) and apply a motor torque to get the tank to turn on the spot.

If anybody has any suggestions as to how I can get a vehicle to "turn on the spot", I'd love to hear it!

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

Answer by duck · Feb 16, 2010 at 12:19 PM

I've done this using the technique that you described (although with more wheels - 8 on each side).

You might find that if the sideways friction of the wheels is preventing the vehicle from rotating, you could actually angle the wheels to point in the direction of the rotation, so that they don't get dragged sideways.

Because the wheelcolliders are invisible, you wouldn't have to see this 'fake' wheel turning.

(Engage ASCII diagram mode!)

// when rotating:       when driving straight:
//
//      /####\                 |####|
//       ####                   ####
//       ####                   ####
//      ####/                 |####|
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
2

Answer by Ashkan_gc · Feb 16, 2010 at 11:47 AM

you should turn left and right wheel colliders 90 and -90 and then accelerate. if wheel colliders are not good for your needs use sphere collider and rigidbodies and configurable joints.

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 ikelaiah · Jun 02, 2013 at 09:19 PM 0
Share

A very good suggestion.

avatar image Runalotski · Apr 22, 2014 at 06:07 AM 0
Share

Hello i am tryng to do that same thing but found i differnt salution.

i used 6 collides 3 for left and 3 for the right track

the wheel 4 wheel colliders at the front and back have high sidways slip, by lowering the extremuum value to 2000, so that they can be forced to move but are used to help motor the behocal and make it stable.

th two middle colliders have little sidways slip to stop the tank sliding on a hill to make up for the other collders having high slip. But because they are in the center and are perpendicular to the center of rotation they rotate fine. I only have one mass in my tank at the moment so was very simple and will need to be changed over time.

A problem i had is if the tank moves forward or backwords during rotation the problem got worse and it speeds off. Adding a ridigid body to the tank with some drag APPEARS to solve the issue, I have not fully tested it but it fits my needs atm.

hope this works for you or helps someone else.

avatar image
-1

Answer by Esteban · Dec 29, 2010 at 01:01 AM

Hey, I'm working on the same but not working. Can you share your codes? Thanks!

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

2 People are following this question.

avatar image avatar image

Related Questions

Fast motion of vehicle 0 Answers

Question about Wheel collider use 1 Answer

Getting contact force between two rigidbodies 1 Answer

AddExplosionForce 0 Answers

Car goes a bit left when moving 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