summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-28 10:56:00 +0200
committerGitHub <noreply@github.com>2019-05-28 10:56:00 +0200
commit335111c98f1504df175ecf5660a46b702ef332fb (patch)
tree78c3c4ea56fc6bf416bc89dadc2aad75bf60021f /scene
parente3735a5d5a13a7d9cf3c0c9731594427db149614 (diff)
parent6bd271139d8192bdac9c9cf0e5fd2d007b967598 (diff)
Merge pull request #28581 from Lisapple/patch-1
Fixing Curve2D/3D baked interpolated values
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/curve.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index ece8ad4bb0..950518aa6e 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -782,7 +782,8 @@ Vector2 Curve2D::interpolate_baked(float p_offset, bool p_cubic) const {
if (idx >= bpc - 1) {
return r[bpc - 1];
} else if (idx == bpc - 2) {
- frac /= Math::fmod(baked_max_ofs, bake_interval);
+ if (frac > 0)
+ frac /= Math::fmod(baked_max_ofs, bake_interval);
} else {
frac /= bake_interval;
}
@@ -1352,7 +1353,8 @@ Vector3 Curve3D::interpolate_baked(float p_offset, bool p_cubic) const {
if (idx >= bpc - 1) {
return r[bpc - 1];
} else if (idx == bpc - 2) {
- frac /= Math::fmod(baked_max_ofs, bake_interval);
+ if (frac > 0)
+ frac /= Math::fmod(baked_max_ofs, bake_interval);
} else {
frac /= bake_interval;
}
@@ -1396,7 +1398,8 @@ float Curve3D::interpolate_baked_tilt(float p_offset) const {
if (idx >= bpc - 1) {
return r[bpc - 1];
} else if (idx == bpc - 2) {
- frac /= Math::fmod(baked_max_ofs, bake_interval);
+ if (frac > 0)
+ frac /= Math::fmod(baked_max_ofs, bake_interval);
} else {
frac /= bake_interval;
}