Struct bevy_fly_camera::FlyCamera2d
source · pub struct FlyCamera2d {
pub accel: f32,
pub max_speed: f32,
pub friction: f32,
pub velocity: Vec2,
pub key_left: KeyCode,
pub key_right: KeyCode,
pub key_up: KeyCode,
pub key_down: KeyCode,
pub enabled: bool,
}
Expand description
A set of options for initializing a FlyCamera.
Attach this component to a Camera2dBundle
bundle to control it with your keyboard.
Example
fn setup(mut commands: Commands) {
commands
.spawn(Camera2dBundle::default())
.with(FlyCamera2d::default());
}
Fields§
§accel: f32
The speed the FlyCamera2d accelerates at.
max_speed: f32
The maximum speed the FlyCamera can move at.
friction: f32
The amount of deceleration to apply to the camera’s motion.
velocity: Vec2
The current velocity of the FlyCamera2d. This value is always up-to-date, enforced by FlyCameraPlugin
key_left: KeyCode
Key used to move left. Defaults to A
key_right: KeyCode
Key used to move right. Defaults to D
key_up: KeyCode
Key used to move up. Defaults to W
key_down: KeyCode
Key used to move forward. Defaults to S
enabled: bool
If false
, disable keyboard control of the camera. Defaults to true
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for FlyCamera2d
impl Send for FlyCamera2d
impl Sync for FlyCamera2d
impl Unpin for FlyCamera2d
impl UnwindSafe for FlyCamera2d
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
Return the
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.§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) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self
using data from the given [World]