pub struct ForceFieldWorld {
pub composite: ForceComposite,
pub gravity: Vec3,
pub gravity_enabled: bool,
/* private fields */
}Expand description
Global registry for all force fields active in the world.
Fields§
§composite: ForceComposite§gravity: Vec3Gravity constant applied to all particles unless overridden.
gravity_enabled: boolImplementations§
Source§impl ForceFieldWorld
impl ForceFieldWorld
pub fn new() -> Self
pub fn add_gravity_well( &mut self, pos: Vec3, strength: f32, radius: f32, ) -> ForceFieldId
pub fn add_vortex( &mut self, pos: Vec3, axis: Vec3, strength: f32, radius: f32, ) -> ForceFieldId
pub fn add_turbulence(&mut self, strength: f32, frequency: f32) -> ForceFieldId
pub fn add_wind(&mut self, direction: Vec3, speed: f32) -> ForceFieldId
pub fn add_attractor( &mut self, pos: Vec3, strength: f32, radius: f32, ) -> ForceFieldId
pub fn add_repulsor( &mut self, pos: Vec3, strength: f32, radius: f32, ) -> ForceFieldId
pub fn add_drag(&mut self, coefficient: f32) -> ForceFieldId
pub fn add_buoyancy(&mut self, gravity: f32) -> ForceFieldId
pub fn add_field(&mut self, kind: ForceFieldKind) -> ForceFieldId
pub fn remove_field(&mut self, id: ForceFieldId)
pub fn get_mut(&mut self, id: ForceFieldId) -> Option<&mut ForceField>
pub fn tick(&mut self, dt: f32)
pub fn apply_to_particles(&self, particles: &mut Vec<Particle>)
pub fn field_count(&self) -> usize
Source§impl ForceFieldWorld
impl ForceFieldWorld
Sourcepub fn debug_sample(&self, pos: Vec3) -> ForceDebugSample
pub fn debug_sample(&self, pos: Vec3) -> ForceDebugSample
Sample the force at a given position with a synthetic particle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ForceFieldWorld
impl RefUnwindSafe for ForceFieldWorld
impl Send for ForceFieldWorld
impl Sync for ForceFieldWorld
impl Unpin for ForceFieldWorld
impl UnsafeUnpin for ForceFieldWorld
impl UnwindSafe for ForceFieldWorld
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.