# rotate a object around the x axis like other object... stucks at 90 degrees

I really need now some help with this because I wasted already a week with my script because I thought it was something wrong with it but now I found out it was the euler angle 90 degree problem…

ok imagine 2 objects. the 2 objects have 2 children.
object 1 has child-A.
object 2 has child-B.

now I want that child-B’s eulerAngle.x should be the same rotation as the x axis of child-A.

But as I sayed above it stops at 90 degree and then it starts turning backwards till 270 or something… and then it rotates again normal till 90 degree.

Child-B should only rotate around his X axis.
and there is the problem…

how do I get a perfect X value of Child-A.

Edit:
Here is the code I am using now…

I have 3 bones here because I need then later to rotate the first one 99%
the second 66% and the third 33% with the palm.

``````var forearm1 : Transform;
var forearm2 : Transform;
var forearm3 : Transform;
var palm : Transform;

//Debug:
var palmRot : float;
var forearmRot1 : float;
var forearmRot2 : float;
var forearmRot3 : float;

function Update()
{
var xRotation = palm.rotation.eulerAngles.x;

forearm1.localRotation.eulerAngles.x = xRotation;
forearm2.localRotation.eulerAngles.x = xRotation;
forearm3.localRotation.eulerAngles.x = xRotation;

//Debug
palmRot = palm.rotation.eulerAngles.x;
forearmRot1 = forearm1.localRotation.eulerAngles.x;
forearmRot2 = forearm2.localRotation.eulerAngles.x;
forearmRot3 = forearm3.localRotation.eulerAngles.x;
}
``````

Do you really need the angle value or just want to set the same rotation on both childs?
Because internally Unity uses Quaternions and when you convert this to Euler angels, you can get strange values.

If you just want the same rotation, just do

``````childB.transform.rotation = childA.transform.rotation;
``````

I made some progress now… I put now every bone into an empty that where so rotated that now the z axis needed to be rotated… it looks now promising.
I get now a full 360 rotation.

still it would be great if there would not be a need to put every bone into an empty…
rotating the bones in Blender would require again more work… if there is no other solution I think then I would need to rotate the bones in Blender…

but this is odd why does every other axis works perfect but only the damn x axis not…

Ok I think the best solution in my case is if I use the emptys or I rearrange the bones in Blender.

It really seems that the X axis is in unity not able to rotate a perfect 360 degree round.
I will use the Z axis or the Y axis. they seem to work like they should…

you all can try it for yourself. put an Empty into a unity scene and set it so you see the local rotation. then try to rotate the Empty on the X then Y then Z axis a full round and you will see that the X axis dont work as expected.