I have a simple cube that I rotate in X during game using the rotation handles. When it reaches 90 degrees in X, Y and Z are suddenly set to 180 degrees. Why ?
Then I can not use transform.rotation.eulerAngles.x and apply that single rotation number to another object if my first object goes beyond 90 degres… How could I set the rotation in X of a first object to another object and get rotations that always matches only in X ?
EulerAngles are not a unique way to describe a 3d rotation. In some cases the same rotation can be represented by two “sets” of eulerAngles. Due to the fact that eulerangles are actually 3 successive rotations it’s possible to reach a Gimbal Lock. Unity and other engines uses Quaternions to avoid the gimbal lock problem.
The problem arises when you / unity convert the quaternion to eulerangles. As mentioned above there are sometimes multiple combinations of eulerangles possible for the same rotation. So the conversion sometimes might yield one representation another time a different. You simply shouldn’t use eulerangles to “read” the current value.
If you want to “match” the x rotation of one object to another it depends on your usecase. Keep in mind when the other object is facing the other way (y ±180) then the x-axis will point to a completely different point. Can you explain a bit more in detail what you want to do?