Fixes BlendSpace2D BLEND_MODE_DISCRETE_CARRY.

When BlendSpace2D switches animations, it will now correctly
calculate the previous animation position and length and
apply is to the new animation.

(cherry picked from commit bcb1e2b79f)
This commit is contained in:
bowling-allie 2021-05-01 20:36:43 -07:00 committed by Rémi Verschelde
parent 3b5ee6a38a
commit 86e5893755
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -519,10 +519,10 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) {
float from = 0;
if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) {
//see how much animation remains
from = blend_node(blend_points[closest].name, blend_points[closest].node, p_time, true, 0.0, FILTER_IGNORE, false) - length_internal;
from = length_internal - blend_node(blend_points[closest].name, blend_points[closest].node, p_time, false, 0.0, FILTER_IGNORE, false);
}
mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, 1.0, FILTER_IGNORE, false) + from;
mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, 1.0, FILTER_IGNORE, false);
length_internal = from + mind;
closest = new_closest;