Search Unity

Use cases of Vector3.Orthonormalize()

Discussion in 'Scripting' started by TFgamesOG, Aug 10, 2018.

  1. TFgamesOG

    TFgamesOG

    Joined:
    Jun 2, 2017
    Posts:
    16
    Hi :)

    What use-cases of Vector3.Orthonormalize() (the one with 2 parameters):
    Code (CSharp):
    1. public static void OrthoNormalize(ref Vector3 normal, ref Vector3 tangent);
    I understand the calculation, but I'm not 100% sure for what the function may be good for?

    Thanks!
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,537
    Any time you needed a normal and tangent (say a forward and up vector) that were orthogonal to one another with respect to normal.

    Like a vehicle driving through the hills.

    Or a roller coaster oriented on its tracks.

    They're normalized for convenience, since they'll generally be used for directoinal purposes, and normalized vectors are best used when needing a directional vector.
     
    TFgamesOG likes this.
  3. TFgamesOG

    TFgamesOG

    Joined:
    Jun 2, 2017
    Posts:
    16
    Cool! Thank you - that makes sense ^^
    I always thought about mesh-calculations and so on and totally forgot the game's perspective :)