Flying the plane around without proper physics

main
_ 2020-03-09 02:00:43 +00:00
parent 372761c1b2
commit 8c32e3674d
1 changed files with 4 additions and 2 deletions

View File

@ -136,7 +136,7 @@ impl ControllerState {
delta = delta.mul_quat (Quat::from_rotation_y (spin_f)); delta = delta.mul_quat (Quat::from_rotation_y (spin_f));
} }
if self.is_pressed (KEY_UP) { if self.is_pressed (KEY_UP) {
delta = delta.mul_quat (Quat::from_rotation_x (-spin_f)); delta = delta.mul_quat (Quat::from_rotation_x (-0.5 * spin_f));
} }
if self.is_pressed (KEY_DOWN) { if self.is_pressed (KEY_DOWN) {
delta = delta.mul_quat (Quat::from_rotation_x (spin_f)); delta = delta.mul_quat (Quat::from_rotation_x (spin_f));
@ -194,6 +194,8 @@ impl FlightState {
pub fn step (&mut self, controller: &ControllerState) { pub fn step (&mut self, controller: &ControllerState) {
self.spin_speed = controller.control_quat (&mut self.airplane.ori, self.spin_speed); self.spin_speed = controller.control_quat (&mut self.airplane.ori, self.spin_speed);
self.airplane.pos += self.airplane.ori.mul_vec3 ((0.0, 1.0 / 30.0, 0.0).into ());
} }
} }
@ -254,7 +256,7 @@ impl WorldState {
}, },
flight: FlightState { flight: FlightState {
airplane: Airplane { airplane: Airplane {
pos: (0.0, 0.0, 1.35).into (), pos: (0.0, -0.5, 0.125).into (),
ori: Default::default (), ori: Default::default (),
}, },
spin_speed: 0, spin_speed: 0,