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
3
Question by thz343 · Jul 29, 2013 at 06:42 PM · rigidbodycontrolwheel

How to make a rigidbody move with wheels?

I have a rigidbody which i want to make controllable with the use of wheels (2 or 4 wheels with tank style steering(eg when i press the left arrow key one wheel goes forward the other goes backwards)) and not a character controller. But i don't have a clue as to how to do it. I know that there are similar questions on here but they haven't really helped.

any help would be really appreciated.

Comment
Add comment · Show 6
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 robertbu · Jul 29, 2013 at 06:43 PM 0
Share

Here is a reference page to some videos on using Unity's physics engine. Video #7 is on the Wheel Collider.

http://www.3dbuzz.com/training/view/unity-fundamentals/physics

avatar image thz343 · Jul 29, 2013 at 06:45 PM 0
Share

Actually i can't use wheel colliders as without a physic material the wheel will fall through the floor and wheel colliders don't use physic materials as far as i am aware. Edit: Actually i have found a way to use wheel colliders so i shall have a look at the video.

avatar image VolureDarkAngel · Jul 29, 2013 at 08:04 PM 0
Share

I have watched the Wheel Colliders Video from that site. and it was very informative. If you take the time to check it out, I think that you will agree.

avatar image thz343 · Jul 29, 2013 at 08:23 PM 0
Share

I've found a way to make a wheel move but the wheel (with the rubber physic material and a rigidbody) doesn't get a proper grip on the floor(metal physic material). It just spins round quickly but barely moves anywhere.

avatar image thz343 · Jul 29, 2013 at 08:27 PM 0
Share

@VolureDarkAngel I haven't watched the entire video yet as i found a script segment which allows an object to spin on the y axis. which i am having trouble with(see comment above) using with the wheel.

Show more comments

2 Replies

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

Answer by Xtro · Jul 29, 2013 at 08:03 PM

You should use hinge joints between the body object and the wheel objects. All objects has to have their own colliders and rigidbodies.

If you can attach the hinge joints correctly, your car will move on the wheels. You can apply the material to wheel objects' colliders.

I prefer simple mesh colliders for wheels.

Steps :

Right now, I'm at work, so I can't test it m self but it should be like this:

1)Create the car body with a cube(and a collider on it)

2)Add a rigidbody to it.

3)Create the wheel with a cylinder(and a mesh collider on it)

4)Add a rigidbody to the wheel.

5)Select the collider mesh as a cylinder mesh.

6)Don't parent the wheel under the body in hierarchy window. They must be separate objects.

7)Add a hinge joint on the wheel.

8)Set the axis direction according to where it must be (you can see a orange little line as an axis in the editor window).

9)Set the connectedBody to the car body object.

By doing these, body and wheel moves together. Wheel rotates and body moves on it. You can apply motor force to the hinge joint. So it can basically act like a motor too.

Comment
Add comment · Show 9 · 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 thz343 · Jul 29, 2013 at 08:49 PM 0
Share

how do i use hinge joints?

avatar image Xtro · Jul 29, 2013 at 09:01 PM 0
Share

I edited the answer for detailed info.

avatar image thz343 · Jul 30, 2013 at 09:28 AM 0
Share

I tried what you said and it worked except i can't make the wheels move.

EDIT: Okay i've managed to get the wheels to move but i don't know how to control them

avatar image Xtro · Jul 30, 2013 at 01:29 PM 0
Share

You can write a script to modify the motor values on the wheels. I assume you can write script.

get the hinge joint component from the wheel game object. enable or disable its motor. or change its velocity. if you want to make the car turn left or right, you should rotate the wheels to left or right.

avatar image thz343 · Jul 30, 2013 at 02:03 PM 1
Share

Ok. i'll try and write a script for it. Thanks alot for all of your help!

Show more comments
avatar image
0

Answer by Imankit · Jul 30, 2013 at 11:19 AM

Download this package..

You will get everything you need..

Unity Car

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 Xtro · Jul 30, 2013 at 01:32 PM 1
Share

Posting an asset link shouldn't be an answer. $$anonymous$$aybe you can mention it in a comment below the question.

avatar image cadviz · Aug 20, 2013 at 07:58 AM 0
Share

OOPS!! Here is a massage I got for Unity Car

Your country is blocked due to the U.S. Government restrictions.

Any advice how to get it..?

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

21 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

Related Questions

How to make camera position relative to a specific target. 1 Answer

Aircraft Control 1 Answer

Rigidbody.AddTorque/AddForce Question. 1 Answer

Why is my push rigidbody script not effected by mass? 2 Answers

How to prevent Wheelie on WheelCollider 2 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