Skip to main content

ParticleController

Struct ParticleController 

Source
pub struct ParticleController {
Show 18 fields pub position: [f32; 3], pub previous_position: [f32; 3], pub velocity: [f32; 3], pub move_speed: f32, pub sprint_multiplier: f32, pub locomotion: ParticleLocomotion, pub gravity: f32, pub grounded: bool, pub landing_timer: f32, pub facing_yaw: f32, pub cloud_radius: f32, pub particle_count: u32, pub base_color: [f32; 4], pub movement_force_direction: [f32; 3], pub movement_force_magnitude: f32, pub rheology_blend: f32, pub rheology_target: f32, pub wave_formation: WaveFormationState,
}
Expand description

Particle controller state — owns position, velocity, and locomotion. Updated per frame from input, drives the particle cloud shape.

Fields§

§position: [f32; 3]

World-space center of the particle.

§previous_position: [f32; 3]

Previous frame position (GPU derives anchor velocity).

§velocity: [f32; 3]

Current velocity (m/s).

§move_speed: f32

Movement speed (m/s).

§sprint_multiplier: f32

Sprint speed multiplier.

§locomotion: ParticleLocomotion

Current locomotion state.

§gravity: f32

Gravity (m/s²).

§grounded: bool

Whether the particle is on the ground.

§landing_timer: f32

Time since last landing (seconds) — used for landing squash duration.

§facing_yaw: f32

Facing direction (yaw in radians, 0 = +Z).

§cloud_radius: f32

Cloud base radius (meters).

§particle_count: u32

Number of particles in the particle.

§base_color: [f32; 4]

Base particle color [r, g, b, a].

§movement_force_direction: [f32; 3]

Normalized world-space movement direction (from WASD+yaw).

§movement_force_magnitude: f32

Movement force magnitude: 0=idle, move_speed=walk, sprint=sprint.

§rheology_blend: f32

Current rheology blend (smooth interpolation toward target, 8/sec exponential).

§rheology_target: f32

Rheology target per locomotion state.

§wave_formation: WaveFormationState

Wave formation state — real wave math for particle positions.

Implementations§

Source§

impl ParticleController

Source

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

Source

pub fn update( &mut self, forward: bool, back: bool, left: bool, right: bool, jump: bool, sprint: bool, camera_yaw: f32, dt: f32, ) -> bool

Update the particle from WASD input relative to camera yaw. Returns true if the particle moved this frame.

Source

pub fn wave_offsets(&self) -> &[[f32; 3]]

Get wave formation particle offsets (relative to particle center). These are the real wave-equation-driven positions for GPU upload.

Source

pub fn shape_params(&self) -> ParticleShapeParams

Get the current shape parameters for the particle cloud.

Trait Implementations§

Source§

impl Default for ParticleController

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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, 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.