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 danielng01 · Jan 19, 2014 at 02:32 PM · physicsrigidbody2djointswheel collidersuspension

How to get suspension or wheels collider with the new 2D unity tools

I am trying to make motorcycle game and I want to have suspension of the wheels. In 3D there is wheels collider, but how to get wheels collider on RigidBody2D. I have tried combining joints to achieve this but with no result. I will be glad if someone give me some suggestions how to make suspension with the 2D rigidbody and tools.

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 danielng01 · Jan 19, 2014 at 04:33 PM 0
Share

alt text

I manage to get some kind of suspension with spring joint, but now the wheels are jiggering all the time and by adding hinge joint to empty in the center of the wheel I manage to make it move

The script for moving: using UnityEngine; using System.Collections;

 public class Controller : $$anonymous$$onoBehaviour {
 
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void FixedUpdate () {
         float move = Input.GetAxis("Horizontal");
         Debug.Log(move);
         GameObject wheel1 = GameObject.Find ("wheel1");
         GameObject wheel2 = GameObject.Find ("wheel2");
         HingeJoint2D joint1 = wheel1.GetComponent<HingeJoint2D>();
         HingeJoint2D joint2 = wheel2.GetComponent<HingeJoint2D>();
         Joint$$anonymous$$otor2D motor1 = joint1.motor;
         Joint$$anonymous$$otor2D motor2 = joint2.motor;
         motor1.motorSpeed = move * 5000;
         motor2.motorSpeed = move * 5000;
         joint1.motor = motor1;
         joint2.motor = motor2;
     }
 }


But again is so unrealistic any suggestions

untitled.png (151.7 kB)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by RightHandedMonkey · Jun 06, 2014 at 08:15 PM

Try the new Wheel Joint 2D for objects in Unity 4.5.

If you know of a good tutorial on this as well I would appreciate information on it since I am trying to understand this topic myself.

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
0

Answer by ZANTcr · Aug 05, 2014 at 01:30 AM

Hi, like the first answer posted I recomend use the new WheelJoint2D of Unity 4.5. I did a 2D Vehicle Control for the asset store, in my script the WheelJoint2D are created automatic, but some tips for setup your vehicle with this new component are:

  • Make your wheels child of the carbody.

  • The carbody and the wheels need a rigidbody2d.

  • In your carbody add 2 WheelJoint2D.

  • In the WheelJoint2D drag and drop you wheel to connected rigidbody option.

  • Adjust the anchor option of the WheelJoint2D.

Your wheel object dont need WheelJoint2D, just your carbody.

Comment
Add comment · Show 1 · 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 Ziaxp · May 22, 2015 at 05:53 AM 0
Share

Hey! thanks, u simply explained how to connect wheels with car body and joints etc...

But can u plz tell me, If I want to use motor of RearWheel and FrontWheel, then how would I Script it to get both wheels and apply motor force, suspension etc... to feel and see the car movement realistic.

For instance, you plz see the HillClimb Racing. HillClimb Racing 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

20 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

Related Questions

Connecting SpringJoint2D to Rotating Rigidbody2D With Correct Anchor 0 Answers

Physics (Joint) different in build to in editor 0 Answers

How to create car suspension system? 1 Answer

Rotating Around Joints 0 Answers

When a configurable joint object is a fixed joint of another object 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