Unity 5 - Wheelcollider wrong rotation

Hello Unity.

Some time ago I posted a question about the unity 5 wheel colliders sinking into the ground.
I concluded that it must’ve been the rotation of the wheel collider that just looked outright wrong. I got my theory confirmed when I saw this posted on twitter: https://pbs.twimg.com/media/CAx-5OkWwAA0I18.jpg:large

You can see how my colliders looked when I asked the question back then:

Here’s mine now, after some deleting, editing and adding again:


What is seriously going on? Now it’s rotated on a really special angle. I swear, I did not do anything that could’ve made it rotate on that angle.

The more I mess about with these colliders, the more problems I get.

-Thanks.

Hi Mads232, For starting I use this Unity free tools included with Unity 5

I use the car as starting game object.
It is not the answer you are looking for but can takes out of the problem fast.

I saw a comment that a wheel colliders up is based on rigidbody up.

Them some odd angles you got though. Are they the scene view? (As in not playing)

WheelColliders always point in the “forward” and “down” direction as the rigidbody they’re attached to. The steerAngle value is relative to the rigidbody’s forward direction.

2 Likes

Thank you for your suggestions and answers.

JamesLeeNZ yes this is in scene view. I do have some weird rotations from blender but as it is of now, the parent object’s rotation is 0,0,0. :slight_smile:

Wait, maybe there’s still some rotation issues that may make Unity think that the rigidbody’s up is not my forklift’s up? I’ll check that out later

Also, can center of mass do such a thing?

Are all your rotations 0,0,0 when not in play? You mention your parent, what about the rest? Ideally you will have 0 rotations for everything, including children. Ensuring that will make your life hella easier. Also make sure your pivots are centered, mainly for the wheels.

I dont believe COM will cause your particular issue.

Thank you for your reply. Not all things are 0,0,0. For example the forks are rotated 270. It’s been a pain in the *** to get it as it is now. The wheelcolliders are attached to a new gameObject which is placed at the wheel’s center

its more of a pain in the ass to work with non uniform angles imo. I know its easy to reset the pivots in 3dsmax. I assume it aint too difficult in blender. I would recommend the first thing you do is sort that out.

You’re god damn right. The thing is, Blender’s Y and Z axises are switched. I’ll try but it might take a while before I’m able to, so I’m still open for suggestions.

Its the same in 3ds max. If you reset the pivot, the default imported fxb will have a rotation of 90,0,0. The thing is, you can usually select all objects, reset, rotate, done. Its not hard once you figure it out.

Why might it take a while before youre able to? youll probably save yourself a massive headache if you can.

Incidentally, you can actually edit fxb files in Visual studio (surprisingly). Might have to be 2013 for it to work. I havnt tried resetting pivots using it, but I think you probably can (tbh I was just surprised when it opened)

I know what I have to do, no worries. :slight_smile: It’s just that I’m busy this week so it might take a while before I’m able to.

heh all good. I end up resetting pivots a lot in models, so at some point teach yourself how to do it quickly, because its something you’re probably gonna end up doing a lot

You might try this this Blender To Unity importer.

I’ve been told that a recent version of Blender has a new experimental option at the FBX exporter that resets some transforms before exporting. I haven’t tried, so I can’t tell for sure if/how that would work.

Thank you for your reply! So does your script also have the ability to fix the rotation with .blend files? I really wanna be able to use the blend files, which I just find very useful.

I think my solution will be to rotate the entire thing 90 degrees. :slight_smile:

My script fixes the rotations so when you set 0 degrees in Blender, it results in 0 degrees in Unity. Other angles are translated properly so the model in Unity looks exactly as it was designed in Blender.

Yes I am aware of that, but does this is only work when I export it as fbx or can I use the .blend file? I don’t export to fbx

So I tried turning the forklift -90 degrees in blender, which it did not like:

Although by dragging in just the prefab I got the result I wanted. I’m going to try and copy all of the scripts, colliders and everything over to the new one I just created. Then I’ll see what the result will be.

Now, this looks promising! The wheel colliders looks like they should now.