Skip to main content

PhysicsModifier

Trait PhysicsModifier 

Source
pub trait PhysicsModifier: Send + Sync {
    // Required methods
    fn modify_distance(&self, x: f32, y: f32, z: f32, original_dist: f32) -> f32;
    fn update(&mut self, dt: f32);
    fn name(&self) -> &str;

    // Provided method
    fn is_active(&self) -> bool { ... }
}
Expand description

Trait for simulation-driven SDF modifiers

Required Methods§

Source

fn modify_distance(&self, x: f32, y: f32, z: f32, original_dist: f32) -> f32

Modify the SDF distance at a world-space point.

Returns the modified distance. Positive offset = surface recedes (material removed). Negative offset = surface expands.

Source

fn update(&mut self, dt: f32)

Advance the simulation state by dt seconds.

Source

fn name(&self) -> &str

Name of this modifier (for debugging)

Provided Methods§

Source

fn is_active(&self) -> bool

Whether this modifier has any active effect

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§