reset look around cam properly

This commit is contained in:
2025-05-03 23:26:44 +02:00
parent de0d4a7b9c
commit 366f09d51f

View File

@@ -2,10 +2,7 @@ use avian3d::prelude::*;
use bevy::prelude::*;
use crate::{
GameState,
control::{ControlState, controller_common::PlayerMovement},
loading_assets::UIAssets,
physics_layers::GameLayer,
GameState, control::ControlState, loading_assets::UIAssets, physics_layers::GameLayer,
};
#[derive(Component, Reflect, Debug)]
@@ -152,16 +149,9 @@ fn update(
*cam_transform = Transform::from_translation(cam_pos).looking_at(target, Vec3::Y);
}
fn rotate_view(
controls: Res<ControlState>,
mut cam: Single<&mut CameraRotationInput>,
movement: Res<PlayerMovement>,
) {
fn rotate_view(controls: Res<ControlState>, mut cam: Single<&mut CameraRotationInput>) {
if !controls.view_mode {
if movement.any_direction {
cam.x = 0.;
}
return;
}