EnvironmentQuery2D

Inherits: Node2D

A node used to gather environment data using a QueryGenerator2D and evaluating them using QueryTest2Ds.

Description

EnvironmentQuery2D provides a flexible, node-based system for AI agents to ask spatial questions about the environment. Queries are composed by adding one QueryGenerator2D as child of the environment query and assigning QueryTest2Ds as children of the QueryGenerator2D.

Queries are time sliced in the background to maintain performance.

Properties

Node2D

querier

float

time_budget_ms

1.0

bool

use_debug_shapes

false

Methods

QueryResult2D

get_result()

bool

request_query()


Signals

query_finished(result: QueryResult2D) 🔗

Emitted when the query finishes processing.


Property Descriptions

Node2D querier 🔗

  • void set_querier(value: Node2D)

  • Node2D get_querier()

There is currently no description for this property. Please help us by contributing one!


float time_budget_ms = 1.0 🔗

  • void set_time_budget_ms(value: float)

  • float get_time_budget_ms()

Amount of time in milliseconds the query has each frame for processing. When budget is reached, the query pauses until the next SceneTree.process_frame.


bool use_debug_shapes = false 🔗

  • void set_use_debug_shapes(value: bool)

  • bool get_use_debug_shapes()

If true creates debug visuals in the environment, showing each QueryItem2D.


Method Descriptions

QueryResult2D get_result() 🔗

After requesting a query, the QueryResult2D is cached and can be called with this function.


bool request_query() 🔗

Request a query, processing it in the background, emitting query_finished when done.