Transform.Rotation sometimes returns world rotation of object, other times of parent of object.

Dear Unity3D developers,

I am currently using Unity 2018.2.2019.f1.

I noticed that when I print out the world rotation of one of my gameobjects while it maintains the same rotation and position, transform.rotation does not return the same values at all times.

The first few seconds transform.rotation returns the world rotation of the object itself. However, when the object maintains it’s rotation and position for a few seconds, the values start to switch between the world rotation of the parent and the object itself over time. This is both the case for the Quaternion and eulerAngles.

This behaviour implies that transform.forward does not always project along the z-axis (blue axis) of the gameobject itself.

I couldn’t find any related topics on the Forum; so sorry if I missed related threads that deal with this!

My Questions:

  1. Is this a bug or am I not understanding something regarding the world rotation of a child gameobject?
  2. Is this a specific bug for Unity 2018.2.2019.f1 and has this been fixed in later Unity versions?

Thanks for any input!

I haven’t ever had any issue with rotations, and I use transform.forward extensively among all other properties and methods. Surely there’s some misunderstanding in your side. transform.forward is always object’s local +Z direction in world space.

BTW, I can’t understand which Unity version are you using. You can read the version easily in the title of the Unity’s window.

Dear Edy and other Unity users,

This was a specific bug of the Unity version that I was using. I now updated to 2019.1.2 and it works again properly.

Kind regards,
Hanne