fix: incorrect wrapping angles at 2PI, now PI

main
Sara 2024-12-25 18:23:49 +01:00
parent 2d7555fb6d
commit dc1e09d425
1 changed files with 1 additions and 1 deletions

View File

@ -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);