From 308d56968a767cbe64be7bea093b4ba0c791b276 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 11 Apr 2023 22:25:02 -0700 Subject: [PATCH] Use epsilon comparison --- dGame/dComponents/MovementAIComponent.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index 3db76bee..7acec5f7 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -312,7 +312,9 @@ foundComponent: if (physicsComponent) speed = physicsComponent->speed; - if (speed == -1.0f) speed = 10.0f; + float delta = fabs(speed) - 1.0f; + + if (delta <= std::numeric_limits::epsilon()) speed = 10.0f; m_PhysicsSpeedCache[lot] = speed;