From dc1e09d4250594f69e36b31a4e44218f635bc9be Mon Sep 17 00:00:00 2001 From: Sara Date: Wed, 25 Dec 2024 18:23:49 +0100 Subject: [PATCH] fix: incorrect wrapping angles at 2PI, now PI --- src/enemy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enemy.cpp b/src/enemy.cpp index 52ffd34..bacc884 100644 --- a/src/enemy.cpp +++ b/src/enemy.cpp @@ -28,7 +28,7 @@ void Enemy::_ready() { void Enemy::_process(double delta) { this->set_current_state_name(this->current_state_name); - float const angle_left{gd::Math::wrapf(this->target_rotation - this->get_rotation().y, -M_2_PIf, M_2_PIf)}; + float const angle_left{gd::Math::wrapf(this->target_rotation - this->get_rotation().y, -M_PIf, M_PIf)}; float const step(gd::Math::sign(angle_left) * delta * (this->anim_tree->get_current_state().begins_with("Run") ? this->TURN_SPEED : this->AIM_SPEED)); if(gd::Math::abs(angle_left) <= gd::Math::abs(step)) { this->rotate_y(angle_left);