mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
half camera height when rolling
This commit is contained in:
parent
645debe230
commit
930e075ad1
@ -124,14 +124,28 @@ impl Scene {
|
|||||||
.get(client.entity())
|
.get(client.entity())
|
||||||
.map_or(Vec3::zero(), |pos| pos.0);
|
.map_or(Vec3::zero(), |pos| pos.0);
|
||||||
|
|
||||||
|
let player_rolling = client
|
||||||
|
.state()
|
||||||
|
.ecs()
|
||||||
|
.read_storage::<comp::CharacterState>()
|
||||||
|
.get(client.entity())
|
||||||
|
.map_or(false, |cs| cs.movement.is_roll());
|
||||||
|
|
||||||
// Alter camera position to match player.
|
// Alter camera position to match player.
|
||||||
let tilt = self.camera.get_orientation().y;
|
let tilt = self.camera.get_orientation().y;
|
||||||
let dist = self.camera.get_distance();
|
let dist = self.camera.get_distance();
|
||||||
let up = if self.camera.get_mode() == CameraMode::FirstPerson {
|
|
||||||
1.5
|
let up = match self.camera.get_mode() {
|
||||||
} else {
|
CameraMode::FirstPerson => {
|
||||||
1.2
|
if player_rolling {
|
||||||
|
0.75
|
||||||
|
} else {
|
||||||
|
1.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CameraMode::ThirdPerson => 1.2,
|
||||||
};
|
};
|
||||||
|
|
||||||
self.camera.set_focus_pos(
|
self.camera.set_focus_pos(
|
||||||
player_pos + Vec3::unit_z() * (up + dist * 0.15 - tilt.min(0.0) * dist * 0.75),
|
player_pos + Vec3::unit_z() * (up + dist * 0.15 - tilt.min(0.0) * dist * 0.75),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user