Merge pull request #47128 from ArdaE/master

GLTF importer: Prevent quick accumulation of significant numerical errors in keyframe times
This commit is contained in:
Rémi Verschelde 2021-03-19 00:14:51 +01:00 committed by GitHub
commit 47cf9985eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5633,8 +5633,8 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
animation->track_set_path(track_idx, node_path);
//first determine animation length
const float increment = 1.0 / float(bake_fps);
float time = 0.0;
const double increment = 1.0 / bake_fps;
double time = 0.0;
Vector3 base_pos;
Quat base_rot;
@ -5724,8 +5724,8 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
}
} else {
// CATMULLROMSPLINE or CUBIC_SPLINE have to be baked, apologies.
const float increment = 1.0 / float(bake_fps);
float time = 0.0;
const double increment = 1.0 / bake_fps;
double time = 0.0;
bool last = false;
while (true) {
_interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, gltf_interp);