Esempio n. 1
0
        public static bool GetRayEllipsoidIntersection(Vector3 rayOrigin, Vector3 rayDir, Vector3 ellipseOrigin, Vector3 ellipseRadius, out Vector3 intersectionPoint)
        {
            Vector3 vector  = UnityUtils.Divide(rayDir, ellipseRadius);
            Vector3 vector2 = UnityUtils.Divide(rayOrigin - ellipseOrigin, ellipseRadius);
            float   num     = Vector3.Dot(vector, vector);
            float   num2    = 2f * Vector3.Dot(vector2, vector);
            float   num3    = Vector3.Dot(vector2, vector2) - 1f;
            float   num4    = num2 * num2 - 4f * num * num3;

            if (num4 < 0f)
            {
                intersectionPoint = Vector3.zero;
                return(false);
            }
            float d = (-num2 - Mathf.Sqrt(num4)) / (2f * num);

            intersectionPoint = rayOrigin + d * rayDir;
            return(true);
        }
Esempio n. 2
0
 public unsafe static long $Invoke12(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(UnityUtils.Divide(*(*(IntPtr *)args), *(*(IntPtr *)(args + 1)))));
 }