diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2021-07-16 13:19:55 -0400 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-07-21 00:32:37 -0400 |
commit | 78b0a7da0398dc8c6447b1439a6d07059311c028 (patch) | |
tree | 662e06b568e52c1942a95e0dcff5eff72ede0009 /servers | |
parent | e248d2629ab9cb1dcfa91af5202af4f17754e44f (diff) |
Use is_equal_approx in more places
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics_3d/collision_solver_3d_sat.cpp | 4 | ||||
-rw-r--r-- | servers/physics_3d/shape_3d_sw.cpp | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/servers/physics_3d/collision_solver_3d_sat.cpp b/servers/physics_3d/collision_solver_3d_sat.cpp index 1cfb9ba3ad..6a7f2b73c5 100644 --- a/servers/physics_3d/collision_solver_3d_sat.cpp +++ b/servers/physics_3d/collision_solver_3d_sat.cpp @@ -629,9 +629,7 @@ public: _FORCE_INLINE_ bool test_axis(const Vector3 &p_axis, bool p_directional = false) { Vector3 axis = p_axis; - if (Math::abs(axis.x) < CMP_EPSILON && - Math::abs(axis.y) < CMP_EPSILON && - Math::abs(axis.z) < CMP_EPSILON) { + if (axis.is_equal_approx(Vector3())) { // strange case, try an upwards separator axis = Vector3(0.0, 1.0, 0.0); } diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp index 2ffab0c923..04a174f9c8 100644 --- a/servers/physics_3d/shape_3d_sw.cpp +++ b/servers/physics_3d/shape_3d_sw.cpp @@ -1783,7 +1783,7 @@ bool HeightMapShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 int z = floor(local_begin.z); // Workaround cases where the ray starts at an integer position. - if (Math::abs(cross_x) < CMP_EPSILON) { + if (Math::is_zero_approx(cross_x)) { cross_x += delta_x; // If going backwards, we should ignore the position we would get by the above flooring, // because the ray is not heading in that direction. @@ -1792,7 +1792,7 @@ bool HeightMapShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 } } - if (Math::abs(cross_z) < CMP_EPSILON) { + if (Math::is_zero_approx(cross_z)) { cross_z += delta_z; if (z_step == -1) { z -= 1; |