Angle between two vectors
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: