Fix YPR order

This commit is contained in:
numzero 2024-11-17 00:16:20 +03:00
parent 7b0c09c3d7
commit b6b95b1c94

View File

@ -49,10 +49,10 @@ mod camctl {
} }
pub fn rotate_rel_ypr(&mut self, ypr: Vec3) { pub fn rotate_rel_ypr(&mut self, ypr: Vec3) {
self.rotate_rel_quat(Quat::from_euler(glam::EulerRot::XYZ, ypr.x, ypr.y, ypr.z)); self.rotate_rel_quat(Quat::from_euler(glam::EulerRot::ZYX, ypr.x, ypr.y, ypr.z));
} }
pub fn rotate_rel_quat(&mut self, rot: Quat) { fn rotate_rel_quat(&mut self, rot: Quat) {
self.rot *= rot; self.rot *= rot;
} }
} }
@ -104,12 +104,12 @@ static KEYS_MOVE: &'static [(PhysicalKey, Vec3)] = &[
]; ];
static KEYS_ROTATE: &'static [(PhysicalKey, Vec3)] = &[ static KEYS_ROTATE: &'static [(PhysicalKey, Vec3)] = &[
(PhysicalKey::Code(KeyCode::Numpad9), vec3(1., 0., 0.)), (PhysicalKey::Code(KeyCode::Numpad4), vec3(1., 0., 0.)),
(PhysicalKey::Code(KeyCode::Numpad7), vec3(-1., 0., 0.)), (PhysicalKey::Code(KeyCode::Numpad6), vec3(-1., 0., 0.)),
(PhysicalKey::Code(KeyCode::Numpad5), vec3(0., 1., 0.)), (PhysicalKey::Code(KeyCode::Numpad5), vec3(0., 1., 0.)),
(PhysicalKey::Code(KeyCode::Numpad8), vec3(0., -1., 0.)), (PhysicalKey::Code(KeyCode::Numpad8), vec3(0., -1., 0.)),
(PhysicalKey::Code(KeyCode::Numpad4), vec3(0., 0., 1.)), (PhysicalKey::Code(KeyCode::Numpad9), vec3(0., 0., 1.)),
(PhysicalKey::Code(KeyCode::Numpad6), vec3(0., 0., -1.)), (PhysicalKey::Code(KeyCode::Numpad7), vec3(0., 0., -1.)),
]; ];
struct State<'a> { struct State<'a> {