hitTest

fun hitTest(motionEvent: MotionEvent): List<HitResult>

Tests to see if a ray is hitting any nodes within the scene.

Return

HitResult list containing nodes that were hit sorted by distance. Empty if no nodes were hit.

Parameters

motionEvent

motionEvent The motion event where you want the hit ray to happen from.


fun hitTest(xPx: Float, yPx: Float): List<HitResult>

Tests to see if a ray starting from the screen/camera position is hitting any nodes within the scene and returns a list of HitResult containing all the nodes that were hit, sorted by distance.

Specify the camera/screen/view position where the hit ray will start from in screen coordinates.

Return

HitResult list containing nodes that were hit sorted by distance. Empty if no nodes were hit.

Parameters

xPx

x screen coordinate in pixels

yPx

y screen coordinate in pixels


fun hitTest(viewPosition: Float2): List<HitResult>

Tests to see if a ray starting from the view position is hitting any nodes within the scene and returns a list of HitResult containing all the nodes that were hit, sorted by distance.

Return

HitResult list containing the nodes that were hit sorted by distance. Empty if no nodes were hit.

Parameters

viewPosition

normalized view coordinate x = (0 = left, 0.5 = center, 1 = right) y = (0 = bottom, 0.5 = center, 1 = top)


fun hitTest(ray: Ray): List<HitResult>

Tests to see if a ray starting from the view position is hitting any nodes within the scene and returns a list of HitResult containing all the nodes that were hit, sorted by distance.

Return

HitResult list containing the nodes that were hit sorted by distance. Empty if no nodes were hit.

Parameters

ray

The ray to use for the test.