pub struct PhysicsAgent { /* private fields */ }Expand description
The agent responsible for managing the physics simulation.
It acts as the Control Plane (ISA) for the physics subsystem, deciding which strategies (lanes) to deploy and managing the physics world.
Implementations§
Source§impl PhysicsAgent
impl PhysicsAgent
Sourcepub fn new(provider: Box<dyn PhysicsProvider>) -> Self
pub fn new(provider: Box<dyn PhysicsProvider>) -> Self
Creates a new PhysicsAgent with a given provider.
Sourcepub fn with_telemetry(self, registry: &MetricsRegistry) -> Self
pub fn with_telemetry(self, registry: &MetricsRegistry) -> Self
Attaches a metrics registry to the agent for observability.
Sourcepub fn with_dcc_sender(self, sender: Sender<TelemetryEvent>) -> Self
pub fn with_dcc_sender(self, sender: Sender<TelemetryEvent>) -> Self
Attaches a DCC sender for telemetry events.
Sourcepub fn select_lane(&self) -> &dyn Lane
pub fn select_lane(&self) -> &dyn Lane
Selects the appropriate physics lane based on the current strategy.
Sourcepub fn cast_ray(
&self,
ray: &Ray,
max_toi: f32,
solid: bool,
) -> Option<RaycastHit>
pub fn cast_ray( &self, ray: &Ray, max_toi: f32, solid: bool, ) -> Option<RaycastHit>
Exposes raycasting from the provider.
Sourcepub fn get_debug_render_data(&self) -> (Vec<Vec3>, Vec<[u32; 2]>)
pub fn get_debug_render_data(&self) -> (Vec<Vec3>, Vec<[u32; 2]>)
Returns debug rendering data from the provider.
Sourcepub fn last_step_time(&self) -> Duration
pub fn last_step_time(&self) -> Duration
Returns the duration of the last step.
Sourcepub fn frame_count(&self) -> u64
pub fn frame_count(&self) -> u64
Returns the total number of frames simulated.
Sourcepub fn current_strategy_id(&self) -> StrategyId
pub fn current_strategy_id(&self) -> StrategyId
Returns the current GORNA strategy ID.
Sourcepub fn fixed_timestep(&self) -> f32
pub fn fixed_timestep(&self) -> f32
Returns the current fixed timestep.
Sourcepub fn set_fixed_timestep(&mut self, dt: f32)
pub fn set_fixed_timestep(&mut self, dt: f32)
Sets the fixed timestep.
Trait Implementations§
Source§impl Agent for PhysicsAgent
impl Agent for PhysicsAgent
Source§fn negotiate(&mut self, _request: NegotiationRequest) -> NegotiationResponse
fn negotiate(&mut self, _request: NegotiationRequest) -> NegotiationResponse
Negotiates with the DCC to determine the best execution strategy
given the current global resource constraints and priorities.
Source§fn apply_budget(&mut self, budget: ResourceBudget)
fn apply_budget(&mut self, budget: ResourceBudget)
Applies a resource budget issued by the DCC.
The agent must adjust its internal logic (e.g., LOD, quality settings)
to stay within the allocated limits.
Source§fn update(&mut self, context: &mut EngineContext<'_>)
fn update(&mut self, context: &mut EngineContext<'_>)
Periodically updates the agent’s internal state.
Source§fn report_status(&self) -> AgentStatus
fn report_status(&self) -> AgentStatus
Reports the current status and health of the agent.
Source§fn execute(&mut self)
fn execute(&mut self)
Executes the agent’s primary function for this frame.
Called after update(), this is where the agent performs its main work.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Allows mutable downcasting to concrete agent types.
Auto Trait Implementations§
impl Freeze for PhysicsAgent
impl !RefUnwindSafe for PhysicsAgent
impl Send for PhysicsAgent
impl Sync for PhysicsAgent
impl Unpin for PhysicsAgent
impl !UnwindSafe for PhysicsAgent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more