From d0147edbf2af891999fb894ea6dbed39b7c1b500 Mon Sep 17 00:00:00 2001 From: Treeco <5021038-Treeco@users.noreply.gitlab.com> Date: Sun, 1 Dec 2019 19:05:28 +0000 Subject: [PATCH] made first person camera follow race heights, minor zoom chances --- voxygen/src/anim/mod.rs | 35 ++++++++++++++++++------------ voxygen/src/hud/settings_window.rs | 2 +- voxygen/src/scene/camera.rs | 1 + voxygen/src/scene/mod.rs | 15 +++++++++++-- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index a65eb04a6d..6f69c17dc0 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -63,6 +63,26 @@ pub struct SkeletonAttr { weapon_y: f32, } +impl SkeletonAttr { + pub fn calculate_scale(body: &comp::humanoid::Body) -> f32 { + use comp::humanoid::{BodyType::*, Race::*}; + match (body.race, body.body_type) { + (Orc, Male) => 0.95, + (Orc, Female) => 0.8, + (Human, Male) => 0.8, + (Human, Female) => 0.75, + (Elf, Male) => 0.85, + (Elf, Female) => 0.8, + (Dwarf, Male) => 0.7, + (Dwarf, Female) => 0.65, + (Undead, Male) => 0.8, + (Undead, Female) => 0.75, + (Danari, Male) => 0.58, + (Danari, Female) => 0.58, + } + } +} + impl Default for SkeletonAttr { fn default() -> Self { Self { @@ -81,20 +101,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { fn from(body: &'a comp::humanoid::Body) -> Self { use comp::humanoid::{BodyType::*, Race::*}; Self { - scaler: match (body.race, body.body_type) { - (Orc, Male) => 0.95, - (Orc, Female) => 0.8, - (Human, Male) => 0.8, - (Human, Female) => 0.75, - (Elf, Male) => 0.85, - (Elf, Female) => 0.8, - (Dwarf, Male) => 0.7, - (Dwarf, Female) => 0.65, - (Undead, Male) => 0.8, - (Undead, Female) => 0.75, - (Danari, Male) => 0.58, - (Danari, Female) => 0.58, - }, + scaler: SkeletonAttr::calculate_scale(body), head_scale: match (body.race, body.body_type) { (Orc, Male) => 0.9, (Orc, Female) => 1.0, diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index 47533f0db2..a351ef61aa 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -934,7 +934,7 @@ impl<'a> Widget for SettingsWindow<'a> { if let Some(new_val) = ImageSlider::discrete( display_zoom, 1, - 200, + 800, self.imgs.slider_indicator, self.imgs.slider, ) diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index 6af3c3eb89..4176c53769 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -154,6 +154,7 @@ impl Camera { } CameraMode::FirstPerson => { self.set_mode(CameraMode::ThirdPerson); + self.tgt_dist = 1_f32; } } } diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index cbe6e570c8..03f48c0d4b 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -8,6 +8,7 @@ use self::{ terrain::Terrain, }; use crate::{ + anim::SkeletonAttr, audio::{sfx::SfxMgr, AudioFrontend}, render::{ create_pp_mesh, create_skybox_mesh, Consts, Globals, Light, Model, PostProcessLocals, @@ -161,6 +162,16 @@ impl Scene { .get(client.entity()) .map_or(false, |cs| cs.movement.is_roll()); + let player_scale = match client + .state() + .ecs() + .read_storage::() + .get(client.entity()) + { + Some(comp::Body::Humanoid(body)) => SkeletonAttr::calculate_scale(body), + _ => 1_f32, + }; + // Alter camera position to match player. let tilt = self.camera.get_orientation().y; let dist = self.camera.get_distance(); @@ -168,9 +179,9 @@ impl Scene { let up = match self.camera.get_mode() { CameraMode::FirstPerson => { if player_rolling { - 0.75 + player_scale * 0.8_f32 } else { - 1.5 + player_scale * 1.6_f32 } } CameraMode::ThirdPerson => 1.2,