Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. 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,053
    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.