

You press Play. Your character moves forward correctly. Then suddenly it starts tilting on the Z axis. Maybe it slowly leans to one side. Maybe it fully tips over. Maybe it rotates slightly every time it collides with something.
This is a very common issue in 3D games, especially when using Rigidbody or CharacterController.
The good news is that this problem is almost always caused by physics settings or rotation control logic, not a mysterious Unity bug.
In most character-based games, you want rotation only on the Y axis (turning left and right), not on X or Z.
If your character uses a Rigidbody and it is not constrained, physics collisions can apply torque. That torque rotates the object on any axis.
Even small collision forces can cause visible tilt.
Select your Rigidbody component and enable:
Or do it via code:
void Start()
{
Rigidbody rb = GetComponent<Rigidbody>();
rb.constraints = RigidbodyConstraints.FreezeRotationX
| RigidbodyConstraints.FreezeRotationZ;
}
This prevents physics from tilting the character.
If you use AddForce in world space without care, the character may accumulate unwanted rotational effects.
Example risky movement:
rb.AddForce(transform.forward * speed);
If collisions occur at angles, rotation may build up.
Instead of relying purely on forces, consider controlling velocity directly:
Vector3 velocity = new Vector3(moveX, rb.velocity.y, moveZ); rb.velocity = velocity;
This gives you more control and reduces random tilt.
If you are using CharacterController, tilt can occur if you rotate the entire player object based on movement direction.
For example:
transform.rotation = Quaternion.LookRotation(moveDirection);
If moveDirection contains vertical components (from slopes), the character may rotate slightly on X or Z.
moveDirection.y = 0f; transform.rotation = Quaternion.LookRotation(moveDirection);
This ensures rotation only happens on the Y axis.
Sometimes the issue is not physics at all.
Your 3D model may have:
Check the model in the Inspector. Reset its rotation to (0, 0, 0). If needed, fix orientation in your 3D software before exporting.
If you are using root motion, animations themselves can contain slight rotation data.
This can slowly tilt the character over time.
If you want to force rotation stability every frame:
void LateUpdate()
{
Vector3 rotation = transform.eulerAngles;
transform.eulerAngles = new Vector3(0f, rotation.y, 0f);
}
This ensures the character can only rotate on Y.
Use this carefully, as it overrides physics rotation completely.
Capsule colliders are stable for characters because they resist tipping. If you are using a BoxCollider, switching to CapsuleCollider can reduce unwanted rotation.
Almost never. This behavior is expected when physics torque or rotation logic is not restricted.
Unity allows full 3D physics simulation by default. If you want character-style movement, you must restrict unwanted axes.
Character tilting on the Z axis usually comes from uncontrolled physics rotation or incorrect rotation calculations.
The simplest and most reliable solution is freezing X and Z rotation in the Rigidbody. After that, verify movement direction calculations and model alignment.
Once rotation is properly constrained, the tilting problem disappears completely.