pub struct CurveEntity {Show 15 fields
pub curves: Vec<EntityCurve>,
pub position: Vec3,
pub center_of_mass: Vec2,
pub hp_ratio: f32,
pub breath_phase: f32,
pub breath_rate: f32,
pub breath_amplitude: f32,
pub force_response: Vec2,
pub name: String,
pub emission_mult: f32,
pub damping: f32,
pub alive: bool,
pub death_time: f32,
pub time: f32,
pub id: u32,
}Expand description
A complete entity composed of mathematical curves.
Fields§
§curves: Vec<EntityCurve>All curves composing this entity.
position: Vec3World-space position of this entity.
center_of_mass: Vec2Center of mass (computed from control points).
hp_ratio: f32HP ratio (1.0 = full, 0.0 = dead).
breath_phase: f32Breathing oscillation phase.
breath_rate: f32Breathing rate (Hz).
breath_amplitude: f32Breathing amplitude (how much curves expand/contract).
force_response: Vec2Accumulated force response (for hit recoil).
name: StringEntity name/type.
emission_mult: f32Global emission multiplier.
damping: f32Global damping for all curve physics.
alive: boolWhether this entity is alive.
death_time: f32Time since death (for dissolution).
time: f32Total accumulated time.
id: u32Unique ID.
Implementations§
Source§impl CurveEntity
impl CurveEntity
pub fn new(name: &str, position: Vec3) -> Self
Sourcepub fn add_curve(&mut self, curve: EntityCurve)
pub fn add_curve(&mut self, curve: EntityCurve)
Add a curve to this entity.
Sourcepub fn update_center_of_mass(&mut self)
pub fn update_center_of_mass(&mut self)
Compute center of mass from all control points.
Sourcepub fn apply_hit(&mut self, direction: Vec2, damage: f32)
pub fn apply_hit(&mut self, direction: Vec2, damage: f32)
Apply a hit from a direction with given damage.
Sourcepub fn break_random_curve(&mut self, rng_seed: u32)
pub fn break_random_curve(&mut self, rng_seed: u32)
Break a random curve (crit hit).
Sourcepub fn is_dissolved(&self) -> bool
pub fn is_dissolved(&self) -> bool
Whether the entity has fully dissolved.
Sourcepub fn bounding_box(&self) -> (Vec2, Vec2)
pub fn bounding_box(&self) -> (Vec2, Vec2)
Bounding box of all control points.
Sourcepub fn alive_curve_count(&self) -> usize
pub fn alive_curve_count(&self) -> usize
Number of alive curves.
Sourcepub fn total_control_points(&self) -> usize
pub fn total_control_points(&self) -> usize
Total number of control points across all curves.
Trait Implementations§
Source§impl Clone for CurveEntity
impl Clone for CurveEntity
Auto Trait Implementations§
impl Freeze for CurveEntity
impl RefUnwindSafe for CurveEntity
impl Send for CurveEntity
impl Sync for CurveEntity
impl Unpin for CurveEntity
impl UnsafeUnpin for CurveEntity
impl UnwindSafe for CurveEntity
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.