Correct model axes in Blender
中文 | English
Run this command at the repository root to replay the examples through the local Unity MCP.
python Docs/Manual/manual/tools/tutorials.py run blender-axis-fix
Click to expand MCP actionsClick to collapse MCP actions
Prepare the teaching sample. The recipe provides ${variables}.
{
"variables": {
"asset": "${fixture}/Tutorial_AxisCheck.fbx"
},
"calls": [
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/CreateFolder",
"args": [
"${fixtureParent}",
"${folder}"
]
},
"expect": {
"contains": "(String)"
}
}
]
}
Use these steps when a model needs a different local rotation basis. Work on a copy.
1. Adjust the rotation and export
- Select the affected object in Unity's Scene view. Set the tool orientation to Local and the handle position to Pivot. Record a known hull dimension and check whether Z points forward and Y points up.
- Work on a copy in Blender Object Mode. Select the object whose local rotation basis needs fixing. Press
R,X,-90, then Enter. - Press Ctrl+A and choose Rotation. Check that the rotation values read zero after applying it.
- Press
R,X,90, then Enter. Choose File → Export → FBX. Use Scale 1.00, Apply Scalings → FBX Units Scale, Forward → −Z Forward, and Up → Y Up. Import the FBX into a test folder in Unity.
The Blender script regenerates the teaching example. The Unity MCP recipe below imports the resulting sample FBX.
blender --background --factory-startup --python-exit-code 1 --python Tools/ManualMcp/BlenderAxisFix/build_model.py -- Tutorial_AxisCheck.fbx
Click to expand MCP actionsClick to collapse MCP actions
[
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/CopyAsset",
"args": [
"Packages/com.shanghaiwindy.coreresources/Editor/DocumentationSamples/blender-axis-fix/Tutorial_AxisCheck.fbx",
"${asset}"
]
},
"expect": {
"contains": "(Boolean) True"
}
},
{
"tool": "invoke",
"arguments": {
"path": "static:UnityEditor.AssetDatabase/ImportAsset",
"args": [
"${asset}",
"ForceSynchronousImport"
]
},
"expect": {
"contains": "OK:"
}
}
]
2. Check the model's forward and up directions
In Unity, verify that the front points along +Z and the top along +Y. Compare the dimensions with the original hull, then rotate the turret and gun separately on the copy to verify their pivots. The sample puts NoseMarker at (0, 0, 1) and RoofMarker at (0, 1, 0).
Click to expand MCP actionsClick to collapse MCP actions
[
{
"tool": "inspect",
"arguments": {
"path": "asset:${asset}/NoseMarker/transform/position"
},
"expect": {
"contains": "(0.00, 0.00, 1.00)"
}
},
{
"tool": "inspect",
"arguments": {
"path": "asset:${asset}/RoofMarker/transform/position"
},
"expect": {
"contains": "(0.00, 1.00, 0.00)"
}
}
]
For other axis issues, check the source model's local axes, FBX export options and Unity import settings. See vehicle basics for hierarchy setup.