All posts in "Blender"

How To: Fix bad -90 x rotation in Unity3D with Blender

Every Unity developer will eventually come across art assets that aren’t rotated right for Unity.  Most of the time, it doesn’t matter and you can simply rotate the objects in your scene.  If they’re static or not rotating from code, there’s really nothing to worry about.  But when your character model’s forward is pointing out of their head, something needs to be done to fix the rotation.  There are a couple ways you can fix the -90 x rotation issue.  One quick & dirty method is to parent the model to another game object and only ever rotate the parent, this works great for most cases.  Today though, we’ll cover how to fix this rotation on the actual model in blender and re-export it with the forward direction facing where it should.

Blender

If you haven’t used blender, don’t worry, I’ll walk you through the parts you need step by step.  If you don’t have blender installed, you can download it free here: https://www.blender.org/download/

The Example

Take a look at this character body.  It looks right, but the rotation is -90 on the x.

If we reset the rotation you can see that the forward vector is actually pointing up out where the head goes..

Let’s fix it

It’s time to open blender and get this model fixed up.

Once you launch blender, select File->Import->FBX

Browse to your model and select Import (or double click it)

To the right, you should see your blender scene view.  It’s similar to the Unity Scene hierarchy and shows you the objects in your scene as a tree.

Because we imported this FBX into a ‘new project’, there’s a bit of extra stuff.

You can right click on the extra stuff to delete it all.

In my case, I’m deleting the “Camera“, “Cube“, and “Lamp

After I’m done, it looks like this

 

Okay, it’s time to rotate!

Now that we have the model imported and the scene cleaned up, let’s fix the rotation.

Select your model by right clicking on it OR left clicking it in the scene tree view.

On the top left, under Tools, you should see a “Rotate” button.

Click Rotate.

If you look down, you’ll see that a rotate dialog is now visible.

Set the Angle to -90  (make sure it’s negative).

Check the “X” box for Constraint Axis (we only want to rotate this on the X axis)

Applying the Rotation

Move the mouse over the model

Using the keyboard, hit ctrl-a.

You should see a dialog like this.

Click Rotation

Exporting the Fixed Model

Rotation is done, it’s time to export our fixed model.

In the menu, select File->Export->FBX

Give the model a new name (or overwrite your existing if you have it in source control)

Click Export FBX

Now jump back to Unity and check out the fixed rotation!

Continue reading >
Share