pub enum TargetReachedCondition {
Distance(f32),
VisibleAtDistance(f32),
StraightPathDistance(f32),
}
Expand description
The condition to consider the agent as having reached its target. When this condition is satisfied, the agent will stop moving.
Variants§
Distance(f32)
The target is reached if it is within the provided (Euclidean) distance of the agent. Useful if the target is surrounded by small obstacles which don’t need to be navigated around (e.g. the agent just needs to be close enough to shoot at the target, which is surrounded by cover). Alternatively, if the distance is low, this can simply mean “when the agent is really close to the target”.
VisibleAtDistance(f32)
The target is reached if it is “visible” (there is a straight line from the agent to the target), and the target is within the provided (Euclidean) distance of the agent. Useful if the agent should be able to see the target (e.g. a companion character should remain visible to the player, but should ideally not stand too close).
StraightPathDistance(f32)
The target is reached if the “straight line” path from the agent to the target is less than the provided distance. “Straight line” path means if the agent’s path goes around a corner, the distance will be computed going around the corner. This can be more computationally expensive, as the straight line path must be computed every update. Useful for agents that care about the actual walking distance to the target.
Trait Implementations§
source§impl Clone for TargetReachedCondition
impl Clone for TargetReachedCondition
source§fn clone(&self) -> TargetReachedCondition
fn clone(&self) -> TargetReachedCondition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Component for TargetReachedCondition
impl Component for TargetReachedCondition
source§impl Debug for TargetReachedCondition
impl Debug for TargetReachedCondition
impl Copy for TargetReachedCondition
Auto Trait Implementations§
impl RefUnwindSafe for TargetReachedCondition
impl Send for TargetReachedCondition
impl Sync for TargetReachedCondition
impl Unpin for TargetReachedCondition
impl UnwindSafe for TargetReachedCondition
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.