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