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?
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.
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!