//translated from UnityEngine /// Returns the signed angle between two vectors in radians public static float angle(float3 from, float3 to) { var num = (from.lengthsq() * to.lengthsq()).sqrt(); return(num < 1.00000000362749E-15f ? 0 : (math.dot(from, to) / num).npsaturate().acos()); // * 57.29578f; }
public static float fastangle(float3 from, float3 to) => (math.dot(from, to) / (from.lengthsq() * to.lengthsq()).fastsqrt()).npsaturate().acos();