- Home /
Question by
da183 · May 15, 2018 at 12:46 AM ·
scripting problemtutorialtanks
Tanks Tutorial problem - Why UIDirectionControl use localRotation
In the tutorial, the UIDirectionControl is aimed to keep Health Slider the same rotation from the start. Here is my confusion. (For concise, in the codes below, I'll skip saving the value on the left side of equations in Start function.) Why are we using transform.rotation = transform.parent.localRotation
? (transform.parent is the slider's parent, aka the canvas) Why rotation = parent.localRotation
instead of localRotation = parent.rotation
? And why don't we use transform.rotation = transform.parent.rotation
or transform.rotation = transform.rotation
? They seem fine, except they using world space rotation. Is there any difference between rotation and localRotation when we are making an UI that doesn't rotate with its parents.
Comment