From 9f0a96ac896cec2e8d094738e23566652ac45f52 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 10 Jul 2021 23:24:27 +0300 Subject: Physical: division by zero fix --- src/entities/Physical.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 890e7876..e9ae3065 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -521,6 +521,10 @@ CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &poin { float speedA = DotProduct(speed, springDir); float speedB = DotProduct(GetSpeed(point), springDir); +#ifdef FIX_BUGS + if (speedB == 0.0f) + return true; +#endif float step = Min(CTimer::GetTimeStep(), 3.0f); float impulse = -damping * (speedA + speedB)/2.0f * m_fMass * step * 0.53f; if(bIsHeavy) -- cgit v1.2.3