An object that retrieves entities from a scene.
Use entity queries to iterate through all entities in a RealityKit scene
that meet certain criteria. To specify which entities to retrieve, use a
``QueryPredicate``.
To execute the query, pass it into the scene’s ``RealityKit/Scene/performQuery(_:)``
method and then iterate over the results.
```swift
// Build a query to retrieve all anchor components.
let query = EntityQuery(where: .has(AnchorComponent.self))
// Find and modify the scene's entities that have an anchor component.
scene.performQuery(query).forEach { entity in
// Make any needed changes to entities.
}
```
Creates a query that returns all entities in a scene that match specific
criteria.
- Parameters:
- predicate: The criteria that specifies the entities to return.
init · iOS 15.0+
init
TypeScript
static init(): EntityQuery
Swift declaration
init()
Creates a query that returns all entities in a scene.