pub struct NavAgent {
pub position: NavVec3,
pub direction: NavVec3,
pub speed: Scalar,
pub radius: Scalar,
pub min_target_distance: Scalar,
/* private fields */
}Expand description
Nav agent component.
Fields§
§position: NavVec3Current agent position in world space.
direction: NavVec3Current agent normalized direction.
speed: ScalarCurrent speed (units per second).
radius: ScalarAgent sphere radius (used in obstacle and agent avoidance).
min_target_distance: ScalarMnimal distance to target (affects direction, tells how far look for point to go to in an instant).
Implementations§
pub fn new(position: NavVec3) -> Self
pub fn new_with_direction(position: NavVec3, direction: NavVec3) -> Self
pub fn id(&self) -> NavAgentId
pub fn target(&self) -> Option<NavAgentTarget>
pub fn destination(&self) -> Option<&NavAgentDestination>
Sourcepub fn set_destination(
&mut self,
target: NavAgentTarget,
query: NavQuery,
mode: NavPathMode,
mesh: NavMeshID,
)
pub fn set_destination( &mut self, target: NavAgentTarget, query: NavQuery, mode: NavPathMode, mesh: NavMeshID, )
Sets destination to go to.
§Arguments
target- target to go to.query- query quality.mode- path finding quality.mesh- nav mesh to move on.
pub fn clear_path(&mut self)
pub fn recalculate_path(&mut self)
pub fn path(&self) -> Option<&[NavVec3]>
pub fn set_path(&mut self, path: Vec<NavVec3>)
Trait Implementations§
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
fn from_prefab(data: &Value) -> Result<Self, PrefabError>
fn from_prefab_with_extras( data: &Value, _named_entities: &HashMap<String, Entity>, _state_token: ID<PhantomData<dyn State + Send + Sync>>, ) -> Result<Self, PrefabError>
fn to_prefab(&self) -> Result<Value, PrefabError>
fn from_prefab_str(data: &str) -> Result<Self, PrefabError>
fn to_prefab_string(&self) -> Result<String, PrefabError>
fn post_from_prefab(&mut self)
Auto Trait Implementations§
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> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere
T: Default,
fn initialize(&mut self)
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.