Skip to main content

NodeMotion

Struct NodeMotion 

Source
pub struct NodeMotion {
Show 15 fields pub forward: [f32; 3], pub speed: Value, pub speed_multiplier: Value, pub acceleration: Value, pub acceleration_multiplier: Value, pub lift: Value, pub lift_in_world: bool, pub displacement: Option<Value>, pub spin: [Value; 3], pub spin_multiplier: [Value; 3], pub align: bool, pub turns: Option<Turns>, pub drag: Option<Drag>, pub min_speed: Option<f32>, pub max_speed: Option<f32>,
}
Expand description

How an emitter moves in its parent’s frame over its active time.

Fields§

§forward: [f32; 3]

The direction of speed and acceleration in the emitter’s own frame (a unit vector).

§speed: Value

Speed along forward (metres per second) times its multiplier, and acceleration along it (metres per second squared) times its multiplier, functions of the active time.

§speed_multiplier: Value§acceleration: Value§acceleration_multiplier: Value§lift: Value

Acceleration along the emitter frame’s +Y (metres per second squared), or along the world’s +Y when lift_in_world.

§lift_in_world: bool§displacement: Option<Value>

A displacement of the emitter in its parent’s frame (metres), a function of the active time.

§spin: [Value; 3]

Spin about the emitter’s three axes (degrees per second) times a multiplier, functions of the active time.

§spin_multiplier: [Value; 3]§align: bool

Whether the emitter turns to face its motion: its forward along its velocity.

§turns: Option<Turns>§drag: Option<Drag>§min_speed: Option<f32>

The least and the most the speed along forward may be (metres per second): acceleration takes it no further, and a speed that starts outside them is held to them. None for no limit.

§max_speed: Option<f32>

Implementations§

Source§

impl NodeMotion

Source

pub fn advance( &self, state: &mut MotionState, mover: Mover<'_>, active: f32, dt: f32, placement: [f32; 4], )

Moves mover’s state on by dt seconds, ending at the active time active (seconds), the values read at active (random variation drawn in scope 0). placement is the rotation of the emitter’s placement in its parent’s frame (a unit quaternion [x, y, z, w]): the forward and a lift not in the world turn with it.

The speed along the forward is speed times its multiplier plus what acceleration times its multiplier has added, held within min_speed and max_speed; lift adds speed along +Y (the world’s, or the placement’s). The position moves by both, and a displacement, where there is one, replaces it. Spin turns the emitter about its own axes (Y, then X, then Z), and each random turn, every interval seconds from the start, turns its forward by up to max_angle about a random axis across it. An emitter that aligns with its motion faces its forward along its velocity (facing); one at rest keeps the facing it had. Drag is how the particles follow the emitter’s motion, not the motion itself, and is not stepped here.

Trait Implementations§

Source§

impl Clone for NodeMotion

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeMotion

Source§

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

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

impl PartialEq for NodeMotion

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for NodeMotion

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for NodeMotion

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.