After Unity imports the fbx model, the rotation and position of the object automatically change during runtime.

After Unity imports the fbx model, the rotation and position of the object automatically change during runtime.

Problem Description

Today, during the development of the game, I imported an FBX material of a ship from the Internet. I want to use this model to replace the ship that was originally designed with cube as the model.

​ After the model is imported into Unity, it is vertical by default.

​ So I adjusted the rotation and position, and then hung up the various components and scripts.

​ But when running it, I found that,The boat will go crazy and move upright

Resolution process

​ First, eliminate problems caused by collisions between two objects by hiding the character model.

​ Secondly, after modifying the movement speed of the script to 0, I found that the model still stood up, so I thought it might be a problem with the model itself.

So I searched for possible solutions online and found an official document from Unity:


Cause Analysis

The reason for the problem is:The default upward axis in maya is the z-axis, while the default upward axis in unity is the y-axis., causing Maya to import into Unity, the model’s transform is reset and the ship’s rotation is wrong, which ultimately leads toThe code related to changing transform.rotation in the script will cause the parameters of transform.rotation that you have directly adjusted in the inspector panel to return to zero or cause unexpected situations.


Method 1 (simple, requires Maya):

When exporting in Maya, set the axis direction to the y-axis upwards

Method 2 (relatively complicated, refer to the unity documentation):

​ 1. Create an empty object as the parent object of the model

2. Place all components on the empty object (including scripts)

3. Modify the transform value of the sub-object model to the desired state, and keep the transform parameters of the empty object in the default state.

Related Posts

Unity and iFlytek voice interaction: using aiui skills

Unity implements character movement and camera following

Unity 2D side-scrolling game (JUNGLE RULES)

Unity uses XML to create a simple login system

How to play videos in Unity

UE4_UE5 making 3DUI-following the camera direction (with project)

Unity[DateTime]- How to add a validity period to the software

[Unity3D-UGUI Application] (4) Using UGUI pop-up window display model and pop-up window model interaction

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>