better aiming in 3rd person mode
This commit is contained in:
parent
500f5c7953
commit
c2ee7ee3e1
|
@ -151,14 +151,16 @@ pub fn sync_camera_to_player(
|
||||||
let (actor, player_transform) = q_playercam.get_single().unwrap();
|
let (actor, player_transform) = q_playercam.get_single().unwrap();
|
||||||
|
|
||||||
// Rotation
|
// Rotation
|
||||||
camera_transform.rotation = player_transform.rotation * Quat::from_array([0.0, -1.0, 0.0, 0.0]);
|
let rotation = player_transform.rotation * Quat::from_array([0.0, -1.0, 0.0, 0.0]);
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
if settings.third_person {
|
if settings.third_person {
|
||||||
camera_transform.translation = player_transform.translation + camera_transform.rotation * (actor.camdistance * Vec3::new(0.0, 0.2, 1.0));
|
camera_transform.translation = player_transform.translation + rotation * (actor.camdistance * Vec3::new(0.0, 0.2, 1.0));
|
||||||
|
camera_transform.rotation = rotation * Quat::from_euler(EulerRot::XYZ, -0.02, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
camera_transform.translation = player_transform.translation;
|
camera_transform.translation = player_transform.translation;
|
||||||
|
camera_transform.rotation = rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue