aboutsummaryrefslogtreecommitdiff
path: root/core/math/vector3.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-09-06 19:12:28 -0300
committerRémi Verschelde2017-06-30 23:32:13 +0200
commit026c580399c605762369b4f24444020029d232af (patch)
treecc82451210a29a0a4afeb58beb954f6ed5e180d9 /core/math/vector3.cpp
parent920f216a14bc95f0bec0d1ae6243167e0d03a674 (diff)
downloadgodot-026c580399c605762369b4f24444020029d232af.tar.gz
godot-026c580399c605762369b4f24444020029d232af.tar.zst
godot-026c580399c605762369b4f24444020029d232af.zip
Changed Vector3.snap from fmod to stepify, which makes more sense, fixes #6399
(cherry picked from commit 23ababdcd57079182172b1c5467fcd6bb0f303d3)
Diffstat (limited to 'core/math/vector3.cpp')
-rw-r--r--core/math/vector3.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index 35e2b06dd..891b95050 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -63,12 +63,9 @@ int Vector3::max_axis() const {
void Vector3::snap(float p_val) {
- x += p_val / 2.0;
- x -= Math::fmod(x, p_val);
- y += p_val / 2.0;
- y -= Math::fmod(y, p_val);
- z += p_val / 2.0;
- z -= Math::fmod(z, p_val);
+ x = Math::stepify(x, p_val);
+ y = Math::stepify(y, p_val);
+ z = Math::stepify(z, p_val);
}
Vector3 Vector3::snapped(float p_val) const {