KatsBits Community

Game Editing => Video Channel => Topic started by: kat on September 23, 2015, 01:35:32 PM

Title: [Unity] fixing Blender model rotation
Post by: kat on September 23, 2015, 01:35:32 PM

Incorrect (fixing) model rotation in Unity
Both Blender and Unity use different global axes or orientation - in Blender "Z" is "Up", in Unity it's "Y". When Blender made models and meshes are imported this difference often means they're flipped on their back (rotated around what is Blenders "X" axis). To fix this;

FIRST (important!): set the objects "Rotation" property ("N") value for "X" to "-90" and then reset the mesh using "Apply" ("Ctrl+A") - this resets the mesh to essentially lie on its back with an "X" value of "X: -90" (minus or negative 90 degrees).

SECOND (optional): rotate the object back to its original 'upright' position and then continue working or export. This will modify the "X" rotational value to "90°", i.e. plus or positive 90° (degrees), "X: 90". Do NOT reset the mesh.

Once the rotational value is set export as normal - when exporting there's no need to set the "Forward" or "Up" axis information in "FBX Export" properties as Unity ignores this in favour of deriving rotation that from the FBX file itself, i.e. the actual orientation of the models in the Scene.

IF the mesh is not rotated to its original position after compensating for the above do so to continue editing and working on it ("X" will then become positive 90) - if any changes are made to the mesh or Object make sure to go through the process above again to address rotational issues.
Title: Re: [Unity] fixing Blender model rotation
Post by: ratty redemption on October 20, 2015, 11:14:26 PM
i'm really glad we figured this out. i remember it was confusing the hell out of me at the time. and thankfully the fix is relatively quick and only needs to be done once for each object. your video demonstrates it perfectly, which is easier than imagining rotating around axis between the different editors.

i hope to see more tips like this on katsbits in the future.
Title: Re: [Unity] fixing Blender model rotation
Post by: kat on October 21, 2015, 01:02:39 AM
A lot of the explanations found seemed confusing and overly complicated when the solution is actually pretty simple. Obviously the need to do this is negated by using Unity's ability to import *.blend files natively now but it's still a useful tip. And yes, hopefully will be doing more of these short tips.
Title: Re: [Unity] fixing Blender model rotation
Post by: ratty redemption on October 21, 2015, 01:40:19 AM
are the explanations you're referring to from other users who were also struggling with this? and not just what you and i were trying to figure out at the time?

*.blend files do have some advantages, like not having to manually export, as unity will detect when they are updated/saved. although i assume they aren't supported by most 3d modeling apps like the *.fbx format is? and *.blend files can become bloated with redundant data if we're not careful.

as i'm continuing to learn the basics of the c sharp scripting language that unity can use, there are several useful coding tips i intend to share in the near future. even today i stumbled across a very quick solution to a performance issue i'd be struggling with for the last week.
Title: Re: [Unity] fixing Blender model rotation
Post by: kat on October 21, 2015, 02:01:38 AM
Others explanations. And yes *.blend files are basically file dumps so it's going to contain a huge amount of useless information associated with the interface and all sorts of other stuff; this might be OK for relative small simple files but larger and more complex items are better exported to *.fbx or other supported format.

What importing *.blend files into Unity may be good for is WIP'ing content, items are loaded into a live environment so changes and modifications can be checked as they happen. Once the design and functionality has been nailed down it may then be best to export to FBX, again largely because the data needs to be fixed and localised (contain only the data that's needed).
Title: Re: [Unity] fixing Blender model rotation
Post by: ratty redemption on October 21, 2015, 10:20:58 AM
understood and i agree.