pub struct FormationMovement {
pub slots: Vec<FormationSlot>,
pub leader: Vec2,
pub heading: f32,
}Expand description
Formation definitions: wedge, line, column, circle.
Fields§
§slots: Vec<FormationSlot>§leader: Vec2§heading: f32Implementations§
Source§impl FormationMovement
impl FormationMovement
pub fn wedge(count: usize, spacing: f32) -> Self
pub fn line(count: usize, spacing: f32) -> Self
pub fn column(count: usize, spacing: f32) -> Self
pub fn circle(count: usize, radius: f32) -> Self
Sourcepub fn slot_position(&self, idx: usize) -> Vec2
pub fn slot_position(&self, idx: usize) -> Vec2
Compute the world-space target position for formation slot idx.
Sourcepub fn steer_to_slot(
&self,
agent: &SteeringAgent,
slot_idx: usize,
slowing_radius: f32,
) -> SteeringOutput
pub fn steer_to_slot( &self, agent: &SteeringAgent, slot_idx: usize, slowing_radius: f32, ) -> SteeringOutput
Steering force for agent idx to maintain its formation slot.
Agent’s slot target = leader pos + rotated offset.
Sourcepub fn update_leader(&mut self, pos: Vec2, heading: f32)
pub fn update_leader(&mut self, pos: Vec2, heading: f32)
Update formation center (leader position) and heading.
Auto Trait Implementations§
impl Freeze for FormationMovement
impl RefUnwindSafe for FormationMovement
impl Send for FormationMovement
impl Sync for FormationMovement
impl Unpin for FormationMovement
impl UnsafeUnpin for FormationMovement
impl UnwindSafe for FormationMovement
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.