What have I learned and Vector3.up

  1. When I need to do moviments I need to use Time.deltaTime because it do not denpends of the frame rate.
  2. I can use GetComponent<[Component]>() to receive the component that I need from the current GameObject (the object where my script is atached).
  3. The Vector3.up depends on the rotation of the object. This is still a clever idea to me. I still don’t know why the up is where the ship is pointing to.

So my question is, why up is up?

To understand Vector3.up, it helps to clarify what a vector is. A vector is an ordered set of numbers representing something. In this case, a Vector3 is an ordered set of three numbers where the order of the numbers represents x-coordinates, y-coordinates, and z-coordinates (in that order). The unity documentation https://docs.unity3d.com/ScriptReference/Vector3-up.html states that Vector3.up is simply a shorthand version for typing Vector3(0, 1, 0). Within the context our the game and usage here, this can be taken as, advance 1 unit in the y dimension. For our ship, if you select it in the scene view, this does indeed correspond to the intuitive up direction in the scene, when the body is at rest. Remember though, since this is only attached to our ship the up direction is relative to the ship itself, not the world. Thus as it turns, it will still advance in the y direction that is “up”; the direction in which rocket shaped ships would be pointing.

See https://docs.unity3d.com/ScriptReference/Vector3.html for more information on Vector3 aspects within Unity

1 Like

Thank you for clarifying me.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms