Ejemplo n.º 1
0
        // returns frame at ray-intersection point, with normal pointing *outwards*
        Frame3 make_hud_sphere_frame(float fHUDRadius, float fHorzAngleDeg, float fVertAngleDeg)
        {
            Ray   r     = MathUtil.MakeRayFromSphereCenter(fHorzAngleDeg, fVertAngleDeg);
            float fRayT = 0.0f;

            MathUtil.IntersectRaySphere(r.origin, r.direction, Vector3.zero, fHUDRadius, out fRayT);
            // fRayT is negative inside sphere (?)
            Vector3 v = r.origin + Math.Abs(fRayT) * r.direction;

            return(new Frame3(v, v.normalized));
        }