I have a script that is almost functional, it gives some good output as to where the player is standing relative to where an object is facing…this could be used to adjust a texture offset with some billboarding to recreate those good ol’ original Doom style enemies.

My problem is that the euler transforms are constant and have nothing to do with an object’s rotations or transform. I can debug my game with an object facing me and the console says he is facing me…I rotate the object by 180 and it still says he is facing me.

Is it possible to ‘zero out’ the object’s eulers to match the objects transform in the update in C#?

Also would those adjusted euler angles be set for only that object or would this adjust the calculations for every code using eulers in the game?..basically a catastrophe…

Hi there

The object’s euler values are its rotation. Basically the transform stores the local position as a vector3, the local scale as a vector3 and the local rotation as a quaternion. Internally these are combined with the parent, and its parent and its parent etc etc to get its world position/scale/rotation.

The euler angles member on transform is a property (effectively a special function that doesn’t need parameters) that:

- when setting the euler angles, converts them to a quaternion then sets the rotation to the new value
- when reading the euler angles, converts the rotation to euler angles then returns them

If you aren’t seeing the euler angles change then there’s something else odd happening. I would guess that somehow you’re looking at the euler angles of the wrong object. If you can see your object is rotating then the euler angles should be changing. However, if its a child of an object that’s rotating, its local rotation won’t be (which is the one that is displayed in the transform in the property inspector).