• 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
Question by xyHeat · Mar 20, 2016 at 02:29 PM · wheel collidersvehicles

My car is shaking [Wheel colliders]

Hey everybody ! I'm making a racing game but i have a problem, i make a track with blender but my vehicule is always shaking and it overturn...

Some one can help me ?

for wheel colliders i use the properties of the standart asset vehicule (i just changed the radius), my vehicule has a scale of 3 3 3 and this is my vehicule controller (i have only 2 scripts) :

using UnityEngine; using System.Collections; using UnityEngine.Networking; //multiplayer using UnityEngine.UI;

public class PlayerController : NetworkBehaviour {

 public GameObject Detector;
 public Text lapsText;
 public int lapsNumber;

 public Camera cam;

 // Déclaration des roues
 public WheelCollider[] wheelColliders;

 // Déclaration des graphismes des roues
 public Transform[] wheels;

 // Puissance des roues
 public float maxTorque = 50;

 //Rigidbody rb; pas encore utilisé


 void Start () {

     lapsNumber = 0;

     if (!isLocalPlayer)
     {
         cam.enabled = false;
     }

     if (isLocalPlayer)
     {
         cam.enabled = true;
     }


     // RigidBody
     //rb = GetComponent<Rigidbody>(); pas encore utilisé
 }
 
 void FixedUpdate () {

     if (!isLocalPlayer)
         return;
     // Si ce n'est pas le joueur, ne rien faire

     float steer = Input.GetAxis("Horizontal"); // Permet de tourner
     float accelerate = Input.GetAxis("Vertical"); // Permet d'avancer ou de reculer

     float finalAngle = steer * 45f; // angle des roues avant max (pour tourner)
     wheelColliders[0].steerAngle = finalAngle;
     wheelColliders[1].steerAngle = finalAngle;

     // le << Vertical >> désigne les touches "w" et "s" (WASD) ou les fleches directionelles haut et bas
     // le << Horizontal >> désigne les touches "a" et "d" (WASD) ou les fleches directionelles gauche et droite

     // application de la puissance
     for (int i = 0; i < wheelColliders.Length; i++)
         // wheelColliders.Length est le nombre de roues
     {
         wheelColliders[i].motorTorque = accelerate * maxTorque;
     } 

     // On peut modifier les touches par défaut.
 }

 void Update()
 {
     UpdateMeshesPosition();
 }

 void UpdateMeshesPosition()
 {
     for(int i = 0; i < wheels.Length; i++)
     {
         Quaternion quad;
         Vector3 pos;
         wheelColliders[i].GetWorldPose(out pos, out quad);
         // enregistrer la posirtion et la rotation

         //applique la position et la rotation sur les graphismes des roues
         wheels[i].position = pos;
         wheels[i].rotation = new Quaternion(quad.x, quad.y, quad.z, quad.w);
     }
 }

 public void AddLap()
 {
     lapsNumber = lapsNumber + 1;
     lapsText.text = lapsNumber + "";
 }    

}

Thank you !

bye, xyHeat

Comment

People who like this

0 Show 2
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 xyHeat · Mar 20, 2016 at 02:45 PM 0
Share

I tried to change the scale of all my objects but it don't work ...

avatar image Bongmo · Apr 23, 2016 at 07:38 PM 0
Share

I would check the wheel colliders.

1 Reply

  • Sort: 
avatar image

Answer by Yuvjeeth · Apr 23, 2016 at 01:05 PM

Hi xyHeat, You can try changing the mass of the Rigidbody, also, try changing the mass of each WheelCollider. This improved stability for me.

Comment
ashokdamani

People who like this

1 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta on June 13. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

40 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

Related Questions

Why do wheel colliders make vehicle not move in a straight line? 0 Answers

Change Camera/Character Controls by entering a vehicle or environmental area. 1 Answer

Leap Motion in Projekt einbinden,Wo findet man Tutorials, wie man eine Leap Motion in ein Projekt einbindet? 1 Answer

Wheel rotate issue 0 Answers

Switch between third and first person controllers. 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