pub struct ShapeBone {
pub start: Vec2,
pub end: Vec2,
pub radius: f32,
pub density: f32,
pub name: String,
}Expand description
A bone segment that defines part of the entity’s shape. Particles are attracted to positions near bones proportional to bone density.
Fields§
§start: Vec2Start position of the bone (relative to entity center).
end: Vec2End position.
radius: f32Radius of influence around the bone.
density: f32Density weight (higher = more particles attracted here).
name: StringBone name (for debugging/editor).
Implementations§
Source§impl ShapeBone
impl ShapeBone
pub fn new(start: Vec2, end: Vec2, radius: f32, density: f32) -> Self
pub fn named(self, name: &str) -> Self
Sourcepub fn closest_point(&self, pos: Vec2) -> Vec2
pub fn closest_point(&self, pos: Vec2) -> Vec2
Closest point on the bone segment to a given position.
Sourcepub fn distance_to(&self, pos: Vec2) -> f32
pub fn distance_to(&self, pos: Vec2) -> f32
Distance from a point to the bone segment.
Sourcepub fn density_at(&self, pos: Vec2, falloff: f32) -> f32
pub fn density_at(&self, pos: Vec2, falloff: f32) -> f32
Density contribution at a point (gaussian falloff from bone).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShapeBone
impl RefUnwindSafe for ShapeBone
impl Send for ShapeBone
impl Sync for ShapeBone
impl Unpin for ShapeBone
impl UnsafeUnpin for ShapeBone
impl UnwindSafe for ShapeBone
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
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>
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.