From 0c667944dd63f0f2396b5ad45e784b040b5b6e34 Mon Sep 17 00:00:00 2001 From: Morph01 <145839520+Morph01@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:49:18 +0200 Subject: [PATCH] fix attack angle --- src/Zombie.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Zombie.cpp b/src/Zombie.cpp index 0b2ab70..e3e09e6 100644 --- a/src/Zombie.cpp +++ b/src/Zombie.cpp @@ -50,9 +50,11 @@ void Zombie::_process(float a_Delta) { this->set_velocity(m_Velocity); look_at(Vector3(this->get_global_position().x + this->get_velocity().x, this->get_global_position().y, this->get_global_position().z + this->get_velocity().z)); + } else if (m_StateMachine->get_current_node().match("Attack")) { this->set_velocity(Vector3(0, 0, 0)); - look_at(Vector3(m_Player->get_global_position().x, m_Player->get_global_position().y / 2, m_Player->get_global_position().z)); + look_at(Vector3(m_Player->get_global_position().x + this->get_velocity().x, this->get_global_position().y, + m_Player->get_global_position().z + this->get_velocity().z)); } m_AnimationTree->set("parameters/conditions/run", !_target_in_range()); m_AnimationTree->set("parameters/conditions/attack", _target_in_range());