From 2325ac3d785cc9afdf769550c0065549e95d19cf Mon Sep 17 00:00:00 2001 From: Imbris Date: Sun, 30 Jan 2022 23:30:34 -0500 Subject: [PATCH] Use ori as fallback for look_dir so that other entities will turn properly when shooting (controller component is not synced) --- voxygen/src/scene/figure/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 99154039a4..f7c268a30d 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -685,7 +685,6 @@ impl FigureMgr { // Velocity relative to the current ground let rel_vel = anim::vek::Vec3::::from(vel.0 - physics.ground_vel); - let look_dir = controller.map(|c| c.inputs.look_dir).unwrap_or_default(); let is_player = scene_data.player_entity == entity; let player_camera_mode = if is_player { camera_mode @@ -706,6 +705,12 @@ impl FigureMgr { anim::vek::Quaternion::::default(), )); + // TODO: Maintain look dir state separate from the controller and sync it for + // all entities. Then read from that instead of the controller here. + let look_dir = controller + .map(|c| c.inputs.look_dir) + .unwrap_or_else(|| Ori::new(ori.into_vec4().into()).look_dir()); + // Maintaining figure data and sending new figure data to the GPU turns out to // be a very expensive operation. We want to avoid doing it as much // as possible, so we make the assumption that players don't care so