Angle between two vectors

From Fancade Wiki
Revision as of 07:15, 16 June 2024 by -u ndefined- (talk | contribs) (Text replacement - "Category:Scripts" to "Category:Scripting")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

You can get an angle between two vectors using this method:

  1. Calculate Cross Product of the vectors
  2. Get Look Rotation of both vectors with Up equal to the cross product
  3. "Subtract" these rotations
  4. Get Y component of the resulting rotation (X and Z will equal to 0)

Note: when you calculate the cross product and "subtract" the rotations, the arguments should be passed in the same order. Otherwise, the angle will be a negative number.

Script example:

Angle between two vectors.png