I am currently facing the gimbal lock problem.

My target:

During animation, apply the half of the local rotation of X in RightHand to RightForeArmTwist, where the local rotation of Y,Z of RightForeArmTwist is keeping the same.

Here is part of the structure of my model:

Root

|-…

|-RightForeArm

|-RightForeArmTwist

|-RightHand

The image above is the parameters of Righthand and RightForeArmTwist when the model is in T pose.

When animation played, the rotation value of RightForeArmTwist is not what I want, and made the model broken.

What I expected is the local rotation of RightForeArmTwist is [-2.535, -2.255, -180].

```
[SerializeField]
Transform rht_hd;
[SerializeField]
Transform rht_farmtwist;
Vector3 twistR_default = Vector3.zero;
void Start() {
twistR_default = rht_farmtwist.localRotation.eulerAngles;
}
void LateUpdate() {
rht_farmtwist.localRotation = Quaternion.Euler(rht_hd.transform.localRotation.eulerAngles.x * -0.5f, twistR_default.y, twistR_default.z);
}
```

Any suggestion in solving the gimbal lock problem?

First of all, this is not gimbal lock. Gimbal lock is when the first two rotations using euler angles cause the 3rd axis of rotation to line up with one of the previous two axis, effectively cutting off motion in the 3rd axis. More than likely you are experiencing another issue to do with euler angles, which is that for any given rotation there are many different sets of euler angles that describe that rotation.

**

When you put rotation angles into the inspector, Unity automatically converts these angles into a Quaternion internally. When you go back to read these angles in code, there is no guarantee that the angles it gives back are the same ones that you plugged in. This can also lead to what *I think* is the issue that you are experiencing, which is taking an euler angle out of context. Euler angles are nice to read when you have relatively simple rotations about 1 or 2 axis, but an euler angle read from a more complex rotation only makes sense *in context with* the other angles. For example, you may look at an object and it looks like it has a large angle of rotation in the z axis, and you are probably correct that there are some sets of euler angles that have a large z value for that rotation, but there is no guarantee that Unity returns one of these sets of angles.

**

So how do you fix your problem? I think “apply the half of the local rotation of X in RightHand” is not really what you want to do, as just plugging in an existing angle into an entirely different rotation is bound to cause trouble. Perhaps if you could describe *functionally* what you want to have happen, then we could find a better approach, however currently it is hard to help as I believe your description of your desired result is slightly flawed