Berecz Balázs
Berecz Balázs

Reputation: 153

Unity rotation.eulerAngles.x not working?

The only debug log is "Debug.Log(head.rotation.eulerAngles.x.ToString());" and the head is the selected object. Why I get 352 and not -49? picture

Upvotes: 0

Views: 117

Answers (1)

CosmicGiant
CosmicGiant

Reputation: 6441

First thing to note is that the inspector is relative to the object's local space, while Transform.rotation is relative to world space.

Then, even with Transform.localRotation, getting from EulerAngles will return a value in the 0-360 range. The inspector has it's own value, and just transposes that to the object's transform.

Upvotes: 1

Related Questions