Search Unity

WheelCollider off by 90 degrees

Discussion in 'Editor & General Support' started by HungryCatGames, Aug 4, 2020.

  1. HungryCatGames

    HungryCatGames

    Joined:
    Jun 24, 2020
    Posts:
    40
    Strange issue. Running Unity 2020. I bring in my Blender vehicle and create the GO under it for wheels, then in there create a transform GO and a collider GO, then in the collider I add the GO where the WheelCollider (WC) gets assigned. However the collider is rotated 90 degrees from the position I need it in. I tried rotating the parent GO but no luck. I tried rotating the vehicle and the WC rotates with it so it's still wrong.

    OK, I can fix this. Went back to Blender, rotated the object 90 degrees and then brought it back in. Followed all the Unity tutorial steps and once again the WC is off by 90 degrees again.

    I created a fresh cube, assigned WC to the cube. All looks good. I have the vehicle in the same orientation as the cube. Moved the WC from the cube to the vehicle and it turns 90 degrees. No matter what I try it will not turn to match the wheel position on the vehicle.

    Any ideas? Perhaps an issue with 2020? I've seen references to this issue going back a number of years but all seemed to be fixed by rotating the parent GO but it doesn't matter which parent I rotate (I tried them all) it won't orient correctly.
     
  2. HungryCatGames

    HungryCatGames

    Joined:
    Jun 24, 2020
    Posts:
    40
    It figures... two days of bashing my head against the wall and within an hour or so of posting (and then taking a break) I figure it out. In Blender I changed the Forward and up settings when exporting and sure enough now the WheelCollider orients correctly.
     
    PraetorBlue likes this.
  3. DomesticYeti

    DomesticYeti

    Joined:
    Jan 22, 2021
    Posts:
    2
    I'm having the same issue. What blender settings did you use for the Forward and Up?
     
  4. HungryCatGames

    HungryCatGames

    Joined:
    Jun 24, 2020
    Posts:
    40
    I don't remember exactly what I did back then. Looking at the Blender file the wheels are drawn so the X-axis is the same as the wheel axel and doing an FBX export it is showing -Z forward and Y up however I don't know if that's the generic settings or if it remembered what I used last time.

    Basically just try each forward and up combination until the import into Unity comes out correct. I do remember messing with it a bit until I hit on the right combo, then everything just worked as expected. Worst case you can brute force it as there are only 24 combinations to try until you hit on the one that works for you.

    -Z,Y
    -Z,-Y
    -Z,X
    -Z,-X
    Z,Y
    Z,-Y
    Z,X
    Z,-X
    Y,Z
    Y,-Z
    Y,X
    Y.-X
    -Y,Z
    -Y,-Z
    -Y,X
    -Y.-X
    X,Y
    X,-Y
    X,Z
    X,-Z
    -X,Y
    -X,-Y
    -X,Z
    -X,-Z
     
  5. DomesticYeti

    DomesticYeti

    Joined:
    Jan 22, 2021
    Posts:
    2
    Thanks! I ended up finding a fix. I had to apply delta location to the the wheels so that their center point was set relative to the car but still 0, 0, 0. Then I exported it with Y up and -Z forward and used FBX scale.