pub struct DropVisualConfig {
pub spin_rad_per_sec: f32,
pub bob_amplitude: f32,
pub bob_period: f32,
}Expand description
Idle motion for the default drop visuals: a slow spin and a bob.
The default is no motion, which keeps the visual on the drop entity itself.
With any motion enabled, a drop’s cube is spawned as a child entity
marked DropVisual and only that child’s local transform is animated, so
the drop’s own Transform (its logical position, used by attraction and
pickup) is never touched.
DropVisualPlugin initializes this resource. Insert your own value to
enable motion:
use bevy::prelude::*;
use voxel_framework::prelude::*;
App::new()
.add_plugins(DefaultPlugins)
.add_plugins((DropsPlugin::<DefaultItem>::new(), DropVisualPlugin::<DefaultItem>::new()))
.insert_resource(DropVisualConfig {
spin_rad_per_sec: 1.5,
bob_amplitude: 0.05,
bob_period: 2.0,
});The values are read every frame, so they can be changed while drops exist. Whether a drop gets a child visual is decided once, when its visual is first attached.
Fields§
§spin_rad_per_sec: f32Spin around the drop’s local Y axis, in radians per second. 0.0
disables spinning.
bob_amplitude: f32Peak offset of the bob along the drop’s local Y axis, in world units.
0.0 disables bobbing.
bob_period: f32Seconds for one full up-and-down cycle. Bobbing needs a positive, finite period.
Implementations§
Source§impl DropVisualConfig
impl DropVisualConfig
Sourcepub fn is_animated(&self) -> bool
pub fn is_animated(&self) -> bool
true when the configuration produces any motion.
Trait Implementations§
Source§impl Clone for DropVisualConfig
impl Clone for DropVisualConfig
impl Copy for DropVisualConfig
Source§impl Debug for DropVisualConfig
impl Debug for DropVisualConfig
Source§impl Default for DropVisualConfig
impl Default for DropVisualConfig
Source§impl PartialEq for DropVisualConfig
impl PartialEq for DropVisualConfig
impl Resource for DropVisualConfig
impl StructuralPartialEq for DropVisualConfig
Auto Trait Implementations§
impl Forget for DropVisualConfig
impl Freeze for DropVisualConfig
impl Move for DropVisualConfig
impl RefUnwindSafe for DropVisualConfig
impl Send for DropVisualConfig
impl Sync for DropVisualConfig
impl Unpin for DropVisualConfig
impl UnsafeUnpin for DropVisualConfig
impl UnwindSafe for DropVisualConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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