// returns frame at ray-intersection point, with normal pointing *outwards* public static Frame3f GetCylinderFrameFromAngles(float fHUDRadius, float fHorzAngleDeg, float fVertAngleDeg) { Ray3f r = VRUtil.MakeRayFromSphereCenter(fHorzAngleDeg, fVertAngleDeg); float fRayT = 0.0f; RayIntersection.InfiniteCylinder(r.Origin, r.Direction, Vector3f.Zero, Vector3f.AxisY, fHUDRadius, out fRayT); Vector3f v = r.Origin + fRayT * r.Direction; Vector3f n = new Vector3f(v[0], 0, v[2]).Normalized; return(new Frame3f(v, n)); }
public static Frame3f GetCylinderFrameFromAngleHeight(float fHUDRadius, float fHorzAngleDeg, float fVertHeight) { Ray r = VRUtil.MakeRayFromSphereCenter(fHorzAngleDeg, 0); r.direction = fHUDRadius * r.direction + fVertHeight * Vector3.up; r.direction.Normalize(); float fRayT = 0.0f; RayIntersection.InfiniteCylinder(r.origin, r.direction, Vector3f.Zero, Vector3f.AxisY, fHUDRadius, out fRayT); Vector3 v = r.origin + fRayT * r.direction; Vector3 n = new Vector3(v[0], 0, v[2]).normalized; return(new Frame3f(v, n)); }