motionEventToRay

fun View.motionEventToRay(motionEvent: MotionEvent): Ray

Calculates a ray in world space going from the near-plane of the camera and going through a point in screen space.

Screen space is in Android device screen coordinates: TopLeft = (0, 0), BottomRight = (Screen Width, Screen Height). The device coordinate space is unaffected by the orientation of the device.

Return

A Ray from the camera to far / infinity

Parameters

motionEvent

The motion event where you want the world position.