bevy_debug_camera/components.rs
1use bevy::prelude::*;
2
3/// Any entity with this component will be controllable using the default bindings for
4/// this plugin. For more information on controls, refer to the crate root.
5#[derive(Debug, Component)]
6pub struct DebugCamera {
7 /// Up vector for the camera. Will be kept as a unit vector and perpendicular to fwd
8 /// automatically by our systems. Should not be initialised to be co-linear with fwd.
9 pub up: Vec3,
10 /// Forward vector for the camera. Will be kept as a unit vector and perpendicular to up
11 /// automatically by out systems. Should not be initialised to be co-linear with up.
12 pub fwd: Vec3,
13 /// The position in global space of the camera. Should be initialised by the user. We will
14 /// update this automatically.
15 pub position: Vec3,
16 /// This is a configurable setting for this camera. It is the speed (in units/second) at which
17 /// the camera should translate when going at full speed.
18 pub speed_translate: f32,
19 /// This is a configurable setting for this camera. It is the speed (in radians/second) at
20 /// which the camera should rotate when going at full speed.
21 pub speed_rotate: f32,
22}
23
24impl Default for DebugCamera {
25 fn default() -> DebugCamera {
26 DebugCamera {
27 up: Vec3::new(0., 1., 0.),
28 fwd: Vec3::new(1., 0., 0.),
29 position: Vec3::default(),
30 speed_translate: 10.,
31 speed_rotate: std::f32::consts::FRAC_PI_4,
32 }
33 }
34}