Contents

hitTest(_:query:mask:)

Searches for objects corresponding to a point in the view based on a query and a collision mask.

Declaration

@MainActor @preconcurrency func hitTest(_ point: CGPoint, query: CollisionCastQueryType = .all, mask: CollisionGroup = .all) -> [CollisionCastHit]

Parameters

  • point:

    A point in the view’s coordinate system.

  • query:

    The query type.

  • mask:

    A collision mask that can be used to prevent hits with certain objects.

Return Value

An array of hit results.

Discussion

The method ignores entities that lack a CollisionComponent.

See Also

Finding entities at a point in the view