Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Wheel colliders arent working properly

Discussion in 'Physics' started by Kavsic, Jan 21, 2022.

  1. Kavsic

    Kavsic

    Joined:
    Dec 10, 2021
    Posts:
    3
    Hello.
    I am new to Unity and i am working with wheelColliders but mine arent working properly.
    The weel colliders fal through the groound and when i put acceleration the weels spin but the car doesnt move.
    I have the same code as this video.
    If you know anny anwsers please replay.
    Thansks.
    Screenshot_3.png Screenshot_1.png
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,428
    Your wheel colliders are tilted 90 degrees, so they're "horizontal" and don't collide with the ground. The direction of the collision is given by the orange segment in the WheelCollider gizmo:

    upload_2022-1-21_13-19-21.png

    Vehicles must follow a few rules in order to work properly:
    • GameObjects containing WheelColliders can't have any rotation in their transform nor in any of their parents.
    • Scale must be 1,1,1 in WheelColliders and all their parents.
    • The "front" direction of the car must face the positive Z axis of the GameObject containing the Rigidbody.
    • Similarly, the "up" direction must face the positive Y axis.
    Most likely the 3D model of the car doesn't follow the front/up conventions. You can create the car objects in Unity (Rigidbody, Collider, WheelColliders) using the correct convention, then add the 3D model to a new child GameObject. You can rotate and scale this child GameObject as necessary so the 3D model visually faces the correct directions.

    More information on how to design and use 3D models in vehicles (specific to Vehicle Physics Pro, but also applicable to Unity vehicles with standard WheelColliders):
    https://vehiclephysics.com/user-guide/3d-models/
     
  3. Kavsic

    Kavsic

    Joined:
    Dec 10, 2021
    Posts:
    3
    Thank you for your anwser.
    The car wheels and wheel colliders are all in the postitive z axis and positive y axis. I dont know how to turn the orange segment in the WheelCollider gizmo. And i scaled every parent to 1,1,1 but still have te same problem. I also have rigid boddy on the car and a box collider. But no other colliders.
    Here is an image of how it looks now.
    Thank you for helping me.
     

    Attached Files:

  4. unity_44234FBC39E5661FBF5B

    unity_44234FBC39E5661FBF5B

    Joined:
    May 11, 2021
    Posts:
    29
    Why do the wheels look so stretched?
     
  5. Kavsic

    Kavsic

    Joined:
    Dec 10, 2021
    Posts:
    3
    Because i made the car in 1,1,0.5 scale but if i want to make the tyres round i need to make them 1,2,0.5 and when in game look like ovals. This is the closest i managed to male them.