1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use bevy::prelude::*;
//https://bevy-cheatbook.github.io/input/keyboard.html

#[derive(Component)]
pub struct ActiveTransformController;

#[derive(Component, Clone)]
pub struct TransformController {
	pub rotate_speed: f32,
	pub translate_speed: f32,
	pub local_axis: bool,
	pub allow_rotation: bool,
}

impl Default for TransformController {
	fn default() -> Self {
		TransformController {
			translate_speed: 10.,
			rotate_speed: 20.,
			local_axis: false,
			allow_rotation: true,
		}
	}
}

impl TransformController {
	pub fn with_local_axis(&mut self) -> &mut Self {
		self.local_axis = true;
		self
	}
	pub fn with_rotation_disabled(&mut self) -> &mut Self {
		self.allow_rotation = false;
		self
	}
}