aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-07-10 23:24:27 +0300
committererorcun <erorcunerorcun@hotmail.com.tr>2021-07-10 23:24:27 +0300
commite9baf31ad87d85d4159f98dcc91cd3a879122bcb (patch)
tree2b3831a8bb6bbe578e1ff8039d3e4f3d6e7be1ed /src/entities
parentd82dbf91efc022a27853decd109f58aa54ebc1ee (diff)
Physical: division by zero fix
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/Physical.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index 182ff46b..591fb501 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -480,6 +480,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;