Gimball lock problem

This commit is contained in:
Franklin 2023-11-23 09:49:26 -04:00
parent 6806fcc5b4
commit 521491d3a6
2 changed files with 6 additions and 8 deletions

View File

@ -18,9 +18,10 @@ Multiplayer
# TODOs:
- [x] Detach player rotation from character model
- [ ] Weapon Sway
- [ ] Fixing leaning
- [ ] Snap back leaning too quick
- [ ] Weapon Sway PENDING!!!
- [x] Fixing leaning
- [x] Snap back leaning too quick
- [ ] Issue with moving around quickly
- [ ] Bring Crouching back
- [ ] Inspect animation (procedural)
- [ ] Reload animation (procedural)

View File

@ -122,8 +122,6 @@ pub fn follow_cursor_with_camera(
if window.cursor.grab_mode != CursorGrabMode::None {
for mut player_transform in player_query.iter_mut() {
for mut camera_transform in camera_query.iter_mut() {
let (mut yaw, mut pitch) = (player_transform.rotation.to_euler(EulerRot::YXZ).0, camera_transform.rotation.to_euler(EulerRot::YXZ).1) ;
for motion in motions.read() {
@ -177,14 +175,13 @@ pub fn follow_cursor_with_camera(
new_rot.1 = eulers.1;
player_transform.rotation = Quat::from_euler(EulerRot::XYZ, new_rot.0, new_rot.1, new_rot.2);
} else {
let mut eulers = desired_rotation_quat_player.to_euler(EulerRot::XYZ);
eulers.2 = eulers.2 + 0.0f32.to_radians();
let mut new_rot = player_transform.rotation.lerp(
Quat::from_euler(EulerRot::XYZ, eulers.0, eulers.1, eulers.2),
Quat::from_rotation_z(0.0),
time.delta_seconds() / player_values_state.player_lean_time,
).to_euler(EulerRot::XYZ);
new_rot.1 = eulers.1;
player_transform.rotation = Quat::from_euler(EulerRot::XYZ, new_rot.0, new_rot.1, new_rot.2);
}
}