Creates a new ActorQuery instance.
Configuration for the query
Adds an event listener to the event target.
Type of event to listen for
Function to call when the event is triggered
Destroys the query and removes all event listeners.
Call this method when the query is no longer needed to prevent memory leaks.
Dispatches an event to the event target.
Events are processed in the engine event queue at the beginning of each frame in the order they were dispatched.
Type of event to dispatch
Optionalpayload: Record<string, unknown>
Payload of the event
Advanced
Dispatches an event to the event target immediately.
Events are processed immediately and not added to the engine event queue.
Type of event to dispatch
Optionalpayload: Record<string, unknown>
Payload of the event
Gets all actors currently matching the query criteria.
A Set of all actors that match the query filter
Advanced
Gets the event listeners for the event target.
Type of event to get the listeners for
Event listeners for the event target
Advanced
Removes all event listeners from the event target.
Removes an event listener from the event target.
Type of event to remove the listener for
Function to remove the listener for
A query system that automatically tracks actors matching specific criteria.
ActorQuery provides real-time filtering and tracking of actors in a scene based on component presence or custom logic. It automatically updates when actors are added, removed, or have components added/removed.
Example