Skip to main content

SuperpositionObserver

Struct SuperpositionObserver 

Source
pub struct SuperpositionObserver {
    pub position: [f32; 3],
    pub active_radius: f32,
    pub active_radius_sq: f32,
    pub decohere_radius: f32,
    pub decohere_radius_sq: f32,
    pub decohere_tick_rate: u32,
    pub tick_index: u32,
}
Expand description

Observer position and decoherence ring radii.

Three concentric rings around the observer: [0, active_radius] → Active (full simulation) [active_radius, decohere_radius] → Decohering (reduced-rate simulation) [decohere_radius, ∞) → Superposed (no simulation)

The decoherence ring prevents visual pop-in: bodies warm up for a few ticks before becoming fully Active, and cool down before going Superposed.

Fields§

§position: [f32; 3]§active_radius: f32

Inner radius: full Active simulation.

§active_radius_sq: f32§decohere_radius: f32

Outer radius: Decohering transition zone beyond active_radius.

§decohere_radius_sq: f32§decohere_tick_rate: u32

How often Decohering bodies simulate (every Nth tick). Default: 2.

§tick_index: u32

Current tick index (for modulo check on Decohering bodies).

Implementations§

Source§

impl SuperpositionObserver

Source

pub fn new(position: [f32; 3], active_radius: f32) -> Self

Create with default decoherence ring (1.5× active radius, simulate every 2nd tick).

Source

pub fn with_rings( position: [f32; 3], active_radius: f32, decohere_radius: f32, tick_rate: u32, ) -> Self

Create with explicit decoherence ring.

Source

pub fn advance_tick(&mut self)

Advance tick index (call once per step).

Source

pub fn should_decohere_simulate(&self) -> bool

Should a Decohering body simulate this tick?

Source

pub fn classify(&self, body_pos: &[f32; 3]) -> SuperpositionState

Classify a position into a superposition ring.

Trait Implementations§

Source§

impl Clone for SuperpositionObserver

Source§

fn clone(&self) -> SuperpositionObserver

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SuperpositionObserver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SuperpositionObserver

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.