Angle between two vectors: Difference between revisions
(Transferred the page from the old wiki) |
-u ndefined- (talk | contribs) m (Text replacement - "Category:Scripts" to "Category:Scripting") |
||
(One intermediate revision by one other user not shown) | |||
Line 12: | Line 12: | ||
{{Image|Angle between two vectors.png}} | {{Image|Angle between two vectors.png}} | ||
[[Category: | [[Category:Scripting]] |
Latest revision as of 07:15, 16 June 2024
You can get an angle between two vectors using this method:
- Calculate Cross Product of the vectors
- Get Look Rotation of both vectors with Up equal to the cross product
- "Subtract" these rotations
- 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:
