pub struct GlyphCohesion {
pub spring: SpringDamper3,
pub temperature: f32,
pub thermal_vel: Vec3,
pub drift: f32,
pub phase: f32,
}Expand description
Per-glyph cohesion spring connecting the glyph to its formation slot.
Fields§
§spring: SpringDamper3The spring driving this glyph toward its target slot.
temperature: f32Current temperature (0 = cold/calm, 1 = hot/jittery).
thermal_vel: Vec3Thermal velocity — random drift added to spring velocity each frame.
drift: f32How much this glyph has drifted from its slot (0 = at rest, 1 = maximum drift).
phase: f32Phase offset for independent oscillation (prevents lockstep movement).
Implementations§
Source§impl GlyphCohesion
impl GlyphCohesion
Sourcepub fn new(slot_position: Vec3, cohesion_strength: f32, phase: f32) -> Self
pub fn new(slot_position: Vec3, cohesion_strength: f32, phase: f32) -> Self
Create a new cohesion spring at a formation slot position.
Sourcepub fn tick(&mut self, dt: f32, cohesion: f32) -> Vec3
pub fn tick(&mut self, dt: f32, cohesion: f32) -> Vec3
Step the cohesion spring by dt seconds.
Returns the new glyph position including thermal jitter.
Sourcepub fn heat(&mut self, temperature: f32, seed: f32)
pub fn heat(&mut self, temperature: f32, seed: f32)
Apply thermal energy to this glyph (increases jitter).
Sourcepub fn set_target(&mut self, new_slot: Vec3)
pub fn set_target(&mut self, new_slot: Vec3)
Move the target formation slot (animated spring follow).
Sourcepub fn apply_impulse(&mut self, impulse: Vec3)
pub fn apply_impulse(&mut self, impulse: Vec3)
Apply an impulse force (adds to spring velocity).
Auto Trait Implementations§
impl Freeze for GlyphCohesion
impl RefUnwindSafe for GlyphCohesion
impl Send for GlyphCohesion
impl Sync for GlyphCohesion
impl Unpin for GlyphCohesion
impl UnsafeUnpin for GlyphCohesion
impl UnwindSafe for GlyphCohesion
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.