pub struct TnuaObstacleRadar {
pub radius: Float,
pub height: Float,
/* private fields */
}
Expand description
Add this to a character entity to detect obstacles around it.
Obstacles can be used for environment movement actions like climbing and wall-jumping.
This component stores rather limited data - only the detected entities and nothing about their
form or position. See TnuaRadarLens
in the main Tnua crate, which wraps this with a
TnuaSpatialExt
to provide many helper methods for
running more queries on the detected obstacles.
Fields§
§radius: Float
The radius of the radar’s cylinder.
height: Float
The height of the radar’s cylinder.
Implementations§
Source§impl TnuaObstacleRadar
impl TnuaObstacleRadar
pub fn new(radius: Float, height: Float) -> Self
Sourcepub fn pre_marking_update(
&mut self,
tracked_entity: Entity,
tracked_position: Vector3,
up_direction: Dir3,
)
pub fn pre_marking_update( &mut self, tracked_entity: Entity, tracked_position: Vector3, up_direction: Dir3, )
Physics integration crates must call this each frame before they start calling
mark_seen
, and feed it some general information about the character
entity.
Sourcepub fn mark_seen(&mut self, entity: Entity)
pub fn mark_seen(&mut self, entity: Entity)
Physics integration crates should call this for each detected entity during each frame,
after invoking pre_marking_update
.
Sourcepub fn tracked_entity(&self) -> Entity
pub fn tracked_entity(&self) -> Entity
Get the character entity who owns the radar (not the detected obstacle entities!)
Sourcepub fn tracked_position(&self) -> Vector3
pub fn tracked_position(&self) -> Vector3
Get the position of the character who owns the radar (not the detected obstacle’s positions!)
Sourcepub fn up_direction(&self) -> Dir3
pub fn up_direction(&self) -> Dir3
Get the direction considered up.
Sourcepub fn iter_blips(&self) -> impl '_ + Iterator<Item = Entity>
pub fn iter_blips(&self) -> impl '_ + Iterator<Item = Entity>
Iterate over all the blip entities.
Trait Implementations§
Source§impl Component for TnuaObstacleRadar
impl Component for TnuaObstacleRadar
Source§const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
Source§fn register_required_components(
requiree: ComponentId,
components: &mut Components,
storages: &mut Storages,
required_components: &mut RequiredComponents,
inheritance_depth: u16,
)
fn register_required_components( requiree: ComponentId, components: &mut Components, storages: &mut Storages, required_components: &mut RequiredComponents, inheritance_depth: u16, )
Source§fn register_component_hooks(hooks: &mut ComponentHooks)
fn register_component_hooks(hooks: &mut ComponentHooks)
ComponentHooks
.Auto Trait Implementations§
impl Freeze for TnuaObstacleRadar
impl RefUnwindSafe for TnuaObstacleRadar
impl Send for TnuaObstacleRadar
impl Sync for TnuaObstacleRadar
impl Unpin for TnuaObstacleRadar
impl UnwindSafe for TnuaObstacleRadar
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
Source§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
Source§fn register_required_components(
components: &mut Components,
storages: &mut Storages,
required_components: &mut RequiredComponents,
)
fn register_required_components( components: &mut Components, storages: &mut Storages, required_components: &mut RequiredComponents, )
Bundle
.Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more