AutomaticUpdate

Struct AutomaticUpdate 

Source
pub struct AutomaticUpdate<Comp, Set = SpatialSet, Schedule = Update>
where Set: SystemSet, Schedule: ScheduleLabel + Clone,
{ /* 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>

Source

pub fn new() -> AutomaticUpdate<Comp>

Create a new AutomaticUpdate with defaults. Will add to the default ScheduleLabel: Update.

Source

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.

Source

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.

Source

pub fn with_spatial_ds(self, spatial_ds: SpatialStructure) -> Self

Change which spatial datastructure is used.

expects one of:

Source

pub fn with_frequency(self, frequency: Duration) -> Self

Change the update rate.

Expects a Duration which is the delay between updates.

Source

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>

Source§

fn build(&self, app: &mut App)

Configures the App to which this plugin is added.
Source§

fn ready(&self, _app: &App) -> bool

Has the plugin finished its setup? This can be useful for plugins that need something asynchronous to happen before they can finish their setup, like the initialization of a renderer. Once the plugin is ready, finish should be called.
Source§

fn finish(&self, _app: &mut App)

Finish adding this plugin to the 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)

Runs after all plugins are built and finished, but before the app schedule is executed. This can be useful if you have some resource that other plugins need during their build step, but after build you want to remove it and send it to another thread.
Source§

fn name(&self) -> &str

Configures a name for the Plugin which is primarily used for checking plugin uniqueness and debugging.
Source§

fn is_unique(&self) -> bool

If the plugin can be meaningfully instantiated several times in an App, override this method to return false.

Auto Trait Implementations§

§

impl<Comp, Set, Schedule> Freeze for AutomaticUpdate<Comp, Set, Schedule>
where Set: Freeze, Schedule: Freeze,

§

impl<Comp, Set, Schedule> RefUnwindSafe for AutomaticUpdate<Comp, Set, Schedule>
where Set: RefUnwindSafe, Schedule: RefUnwindSafe, Comp: RefUnwindSafe,

§

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>
where Set: Unpin, Schedule: Unpin, Comp: Unpin,

§

impl<Comp, Set, Schedule> UnwindSafe for AutomaticUpdate<Comp, Set, Schedule>
where Set: UnwindSafe, Schedule: UnwindSafe, Comp: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<Marker, T> Plugins<Marker> for T
where T: Plugins<Marker>,