Rotation is broken

I have a simple demo project where my “player object” has a rotation of 0, 45, 0 (xyz).

When I use code to extract this it shows -2.912, 45, -1.969

I use the code:
transform.rotation.eulerAngles;

Why isn’t this shown correctly. I use the rotation for launching a projectile, so it’s a bit weird having the direction of the projectiles turn quicker than my placeholder object

Good day.

1st, rotation is not broken, MAybe you dont understand why this hapens, but ists you, not Unity.

Most probably the object is child of another object? This rotation is the local rotation, not the global.

Or maybe some code or collision is moving it

Hi there. Extending on from tormentoarmagedoom’s answer, it is probably because you have a parent object of the object you are trying to rotate. I have had issues with rotation and positioning in the past, and that was my issue. Perhaps you could try using LocalEulerAngles in your code instead of just EulerAngles, so your code will look something like this ‘transform.rotation.localEulerAngles;’. See if that works and hopefully it will solve your problem! :smiley: