Tuesday 7 November 2017

Unity, How to understand Transform.Rotate(Vector3, Space.Self) ?

when developing in Unity, you always has to use Transform.Rotate() function, one of its overload is
Transform.Rotate(Vector3 v, Space.Self), like this:

void Update () {
    this.transform.Rotate(new Vector3(1, 1, 1), Space.Self);
}

i didn't read any document explain it very well, all give reader some confusion, (really  don't understand why?)

ok, let's use some very straightforward words

Suppose the object which attach this script, the transform.position is (100, 100, 100),

there will be a little box centered by this point,  the diagonal points will be
 (100+1, 100+1, 100+1), (100-1, 100-1,100-1)

if you consider this two points as a line, the object will be rotated based on this line

this is how this function works, easy, en..



No comments:

Post a Comment