Searches for objects corresponding to a point in the view based on a query and a collision mask.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- Xcode 11.0+
Framework
- Reality
Kit
Declaration
func hitTest(_ point: CGPoint, query: Collision Cast Query Type = .all, mask: Collision Group = .all) -> [Collision Cast Hit]
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 Collision
.