87 [[nodiscard]] uint32_t
id()
const {
return m_id; }
Orchestrates spatial indexing and scheduling for Nexus objects.
void invoke(const PerceptionContext &ctx) const
Invoke the perception function with the supplied context.
float query_radius() const
Return the query radius.
uint32_t id() const
Return the stable object id assigned by Fabric.
const PerceptionFn & fn() const
The perception function itself.
std::optional< glm::vec3 > m_position
void set_query_radius(float r)
Set the query radius.
void set_position(const glm::vec3 &p)
Set the position, enabling spatial queries for this object.
const std::optional< glm::vec3 > & position() const
Return the current position, if set.
Sensor(float query_radius, std::string fn_name, PerceptionFn fn)
Construct with a query radius and a named perception function.
std::function< void(const PerceptionContext &)> PerceptionFn
const std::string & fn_name() const
Identifier assigned to the perception function, empty if anonymous.
void clear_position()
Clear the position, disabling spatial queries for this object.
void set_fn_name(std::string name)
Set or replace the perception function's identifier.
Sensor(float query_radius, PerceptionFn fn)
Construct with a query radius and a perception function.
Object that reacts to nearby entities when committed.
Data passed to a Sensor or Agent perception function on each commit.