Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

What is Vector3 Normalize?

Discussion in 'Scripting' started by topaz7, Dec 29, 2012.

  1. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    I'm sorry but I'm not that good in MATHS.
     
  2. Camronas

    Camronas

    Joined:
    Apr 20, 2012
    Posts:
    154
    If a vector becomes normalized it keeps its direction but its length is set to either 1 or 0 depending on factors.
     
    horrormage and Westland like this.
  3. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    Thanks but I'm still confused. What is the direction on vector?(I thought it was a point in world space) and what is the length?
     
  4. Camronas

    Camronas

    Joined:
    Apr 20, 2012
    Posts:
    154
  5. etoreo

    etoreo

    Joined:
    Apr 11, 2012
    Posts:
    104
    Think of it this way... a Vector holds 2 pieces of information - a point in space and a magnitude. The magnitude is the length of the line formed between (0, 0, 0) and the point in space. If you "normalize" a vector (also known as the "unit vector" - Google it), the result is a line that starts a (0, 0, 0) and "points" to your original point in space. If you were to take the length of this "pointer" it would equal 1 unit length. This is helpful for a lot of different reasons.
     
    mango_khan, jipjax and Westland like this.
  6. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    Thank you very much both of you. Finally understood what it is. So, a vector can only contain either magnitude or point?
     
  7. etoreo

    etoreo

    Joined:
    Apr 11, 2012
    Posts:
    104
    A Vector contains both pieces of information, a normalized vector has a magnitude of 1.
     
    mariodebono likes this.
  8. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    A Vector2 is either a point or a direction, depending on what you use it for. For example, if it's (5, 0), then it's either a point at x=5, y=0, or it's a vector pointing along the positive x axis with a slope of 0 and a length of 5. In this case it's not normalized since the length is greater than 1. If you normalize it, then it will become (1, 0) and will have a length of 1.

    --Eric
     
  9. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    Great thanks!