pub struct AutomaticUpdate<Comp, Set = SpatialSet, Schedule = Update>{ /* private fields */ }Expand description
Plugin struct for setting up a spatial datastructure with automatic updating.
#[derive(Component, Default)]
struct EntityMarker;
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(AutomaticUpdate::<EntityMarker>::new()
.with_frequency(Duration::from_secs_f32(0.3))
.with_spatial_ds(SpatialStructure::KDTree2)
.with_transform(TransformMode::GlobalTransform)
)
Implementations§
Source§impl<Comp, Set: SystemSet, Schedule: ScheduleLabel + Clone> AutomaticUpdate<Comp, Set, Schedule>
impl<Comp, Set: SystemSet, Schedule: ScheduleLabel + Clone> AutomaticUpdate<Comp, Set, Schedule>
Sourcepub fn new() -> AutomaticUpdate<Comp>
pub fn new() -> AutomaticUpdate<Comp>
Create a new AutomaticUpdate with defaults. Will add to the default ScheduleLabel: Update.
Sourcepub fn with_schedule<NewSchedule: ScheduleLabel + Clone>(
self,
schedule: NewSchedule,
) -> AutomaticUpdate<Comp, Set, NewSchedule>
pub fn with_schedule<NewSchedule: ScheduleLabel + Clone>( self, schedule: NewSchedule, ) -> AutomaticUpdate<Comp, Set, NewSchedule>
Change the Bevy ScheduleLabel in which this plugin will put its systems.
Sourcepub fn with_set<NewSet: SystemSet + Copy>(
self,
set: NewSet,
) -> AutomaticUpdate<Comp, NewSet, Schedule>
pub fn with_set<NewSet: SystemSet + Copy>( self, set: NewSet, ) -> AutomaticUpdate<Comp, NewSet, Schedule>
Change the Bevy SystemSet in which this plugin will put its systems.
Sourcepub fn with_spatial_ds(self, spatial_ds: SpatialStructure) -> Self
pub fn with_spatial_ds(self, spatial_ds: SpatialStructure) -> Self
Change which spatial datastructure is used.
expects one of:
Sourcepub fn with_frequency(self, frequency: Duration) -> Self
pub fn with_frequency(self, frequency: Duration) -> Self
Change the update rate.
Expects a Duration which is the delay between updates.
Sourcepub fn with_transform(self, transform: TransformMode) -> Self
pub fn with_transform(self, transform: TransformMode) -> Self
Change which Transform is used to extrat coordinates from.
Note: using TransformMode::GlobalTransform might cause double frame-delays
as Transform->GlobalTransform propagation happens in the
TransformPropagate SystemSet in PostUpdate.
You can order this plugins systems by modifying the default SpatialSet
or using your own SystemSet by calling AutomaticUpdate::with_set
Trait Implementations§
Source§impl<Comp: TComp, Set: SystemSet + Copy, Schedule: ScheduleLabel + Clone> Plugin for AutomaticUpdate<Comp, Set, Schedule>
impl<Comp: TComp, Set: SystemSet + Copy, Schedule: ScheduleLabel + Clone> Plugin for AutomaticUpdate<Comp, Set, Schedule>
Source§fn ready(&self, _app: &App) -> bool
fn ready(&self, _app: &App) -> bool
finish should be called.Source§fn finish(&self, _app: &mut App)
fn finish(&self, _app: &mut App)
App, once all plugins registered are ready. This can
be useful for plugins that depends on another plugin asynchronous setup, like the renderer.Source§fn cleanup(&self, _app: &mut App)
fn cleanup(&self, _app: &mut App)
Auto Trait Implementations§
impl<Comp, Set, Schedule> Freeze for AutomaticUpdate<Comp, Set, Schedule>
impl<Comp, Set, Schedule> RefUnwindSafe for AutomaticUpdate<Comp, Set, Schedule>
impl<Comp, Set, Schedule> Send for AutomaticUpdate<Comp, Set, Schedule>where
Comp: Send,
impl<Comp, Set, Schedule> Sync for AutomaticUpdate<Comp, Set, Schedule>where
Comp: Sync,
impl<Comp, Set, Schedule> Unpin for AutomaticUpdate<Comp, Set, Schedule>
impl<Comp, Set, Schedule> UnwindSafe for AutomaticUpdate<Comp, Set, Schedule>
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
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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
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