Struct oxygengine_navigation::components::NavAgent
source · 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: NavVec3
Current agent position in world space.
direction: NavVec3
Current agent normalized direction.
speed: Scalar
Current speed (units per second).
radius: Scalar
Agent sphere radius (used in obstacle and agent avoidance).
min_target_distance: Scalar
Mnimal 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, RandomState>, _state_token: ID<PhantomData<dyn State + Sync + Send>> ) -> 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§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§unsafe fn finalize_raw(data: *mut ())
unsafe fn finalize_raw(data: *mut ())
Safety Read more
fn initialize(&mut self)
§unsafe fn initialize_raw(data: *mut ())
unsafe fn initialize_raw(data: *mut ())
Safety Read more
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.