Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Problem with Wheelcolliders

Discussion in 'Physics' started by Nick_Badger, May 15, 2018.

  1. Nick_Badger

    Nick_Badger

    Joined:
    May 14, 2018
    Posts:
    2
    I'm relatively new to unity and to game-development as a whole, but I've been trying to figure out how wheel colliders work. I've learnt two important things: You cannot rotate the wheelcolliders and the springs are supposed to be pointing down. My problem is this: my springs are pointing to the side.

    I've tried everything I could think of, I even modified my actual model to make the wheels easier to see. I tried turning the wheels in Unity, I tried turning the wheels in Blender and then exporting that to unity, I even tried turning the colliders themselves but that doesn't even seem to have any effect at all. I tried parenting the colliders to the wheels, to the body... whatever I try, the colliders won't turn, and they just drop through the floor until my main body-colliders land.



    I've attached a screenshot, as you can see the springs are horizontal.
    Does anyone know how to fix this?

    Thanks in advance!

    Nick
     

    Attached Files:

  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,212
    Ensure your vehicle's forward direction is +Z. The convention for axes and directions in Unity is:

    Forward: +Z
    Right: +X
    Up: +Y​

    WheelColliders always point "down", that is -Y. Your vehicle is using "Y" as forward direction, thus the WheelColliders are aligned in that same direction.

    Note that the convention affects the physics objects: Rigidbody, Colliders and WheelColliders. These must follow the convention. The visual meshes may be aligned in a different way. If your mesh doesn't match these rules, add it as child of the vehicle's GameObject and modify its local rotation to match the proper directions visually.
     
  3. Nick_Badger

    Nick_Badger

    Joined:
    May 14, 2018
    Posts:
    2
    Thank you!

    I think the problem was that Blender and Unity handle directions slightly differently. In blender, z is up instead of y. This seems to be something that's relatively easily fixed though.
    Many thanks again, I fiddled around with getting the local directions right and it seems to have worked now!
     
    Edy likes this.