pub enum SteeringBehavior {
Show 15 variants
Seek(Vec2),
Flee(Vec2),
Arrive {
target: Vec2,
slow_radius: f32,
},
Pursuit {
quarry_pos: Vec2,
quarry_vel: Vec2,
},
Evade {
threat_pos: Vec2,
threat_vel: Vec2,
},
Wander {
circle_dist: f32,
circle_radius: f32,
jitter: f32,
},
ObstacleAvoidance(Vec<(Vec2, f32)>),
WallAvoidance(Vec<(Vec2, Vec2)>),
PathFollowing {
path: Vec<Vec2>,
radius: f32,
},
Separation,
Alignment,
Cohesion,
LeaderFollowing {
offset: Vec2,
},
Interpose {
a: Vec2,
b: Vec2,
},
None,
}Expand description
All available steering behaviors as a tagged enum for use in combiners.
Variants§
Seek(Vec2)
Flee(Vec2)
Arrive
Pursuit
Evade
Wander
ObstacleAvoidance(Vec<(Vec2, f32)>)
WallAvoidance(Vec<(Vec2, Vec2)>)
PathFollowing
Separation
Alignment
Cohesion
LeaderFollowing
Interpose
None
Implementations§
Source§impl SteeringBehavior
impl SteeringBehavior
Sourcepub fn compute(
&self,
agent: &mut SteeringAgent,
neighbors: &[&SteeringAgent],
leader: Option<&SteeringAgent>,
) -> Vec2
pub fn compute( &self, agent: &mut SteeringAgent, neighbors: &[&SteeringAgent], leader: Option<&SteeringAgent>, ) -> Vec2
Compute the steering force for this behavior.
neighbors and leader are optional context.
Trait Implementations§
Source§impl Clone for SteeringBehavior
impl Clone for SteeringBehavior
Source§fn clone(&self) -> SteeringBehavior
fn clone(&self) -> SteeringBehavior
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SteeringBehavior
impl RefUnwindSafe for SteeringBehavior
impl Send for SteeringBehavior
impl Sync for SteeringBehavior
impl Unpin for SteeringBehavior
impl UnsafeUnpin for SteeringBehavior
impl UnwindSafe for SteeringBehavior
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> 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.