Contents

hitTest(point:in:query:mask:)

Searches the scene for entities at the specified point in the view.

Declaration

func hitTest(point: CGPoint, in space: some CoordinateSpaceProtocol, query: CollisionCastQueryType, mask: CollisionGroup) -> [CollisionCastHit]

Parameters

  • point:

    A point in the provided coordinate space.

  • space:

    The 2D coordinate space in which to interpret the point.

  • query:

    The query type.

  • mask:

    The collision mask that you can use to prevent hits with certain objects. The default value is All, which means the ray can hit all objects. See Collisionfilter for details.

Return Value

An array of hit-test results.

Discussion