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