Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blendspace2D BLEND_MODE_DISCRETE_CARRY freezes or doesn't carry #41028

Closed
nezvers opened this issue Aug 4, 2020 · 6 comments · Fixed by #48375
Closed

Blendspace2D BLEND_MODE_DISCRETE_CARRY freezes or doesn't carry #41028

nezvers opened this issue Aug 4, 2020 · 6 comments · Fixed by #48375

Comments

@nezvers
Copy link

nezvers commented Aug 4, 2020

Godot version:
3.2.2

OS/device including version:
Windows 10

Issue description:
Making pixel art game with AnimationPlayer animating frames in Sprite (using discrete mode - frame by frame). Running has a blend for aiming diagonally and forward (like NES contra). When changing blends they restart animation position using BLEND_MODE_DISCRETE_CARRY but in some cases can freeze whole node (all running animations but then all animations are frozen in the same position).
Happens in the editor too.

Steps to reproduce:
Have a couple of animations (frame by frame in Sprite) that have common visual cues. Set the blend mode to carry.
While Blendspace2D is playing, change blend_position.

Minimal reproduction project:
AnimationTreeBug.zip
Move with arrows and Enter used for a secondary blend.
Notice that when flipping in MOVE state with UP and DOWN dot that goes around is staying in the same place.

@Calinou
Copy link
Member

Calinou commented Apr 3, 2021

This issue was confirmed by latreides in https://godotforums.org/discussion/25912/is-discrete-carry-functional.

@latreides
Copy link

I get the same results in both 3.2.3 and 3.3.3 RC7

@rune-scape
Copy link
Contributor

rune-scape commented May 1, 2021

I'm also running into this bug in version v3.3.stable.official.
Before I found this issue already existed, I made my minimal reproducible project:

DiscreteCarryBug.zip

and a video of it:

discrete_carry_bug.mp4

I expect the number to go from 0 to 7 and loop, spending .1sec on each number, but it flutters around whenever the blend_position changes enough to switch animations. At the end when the mouse moves in fast circles you can see it gets stuck on the last frame and doesn't recover.

With this bug there seems to be no way to easily implement a properly synced 8-directional sprite sheet animation and use it with AnimationTree's state machine travel and transitions. This seems like a somewhat basic and common feature, I'm surprised it's not working.

@rune-scape
Copy link
Contributor

I found the errors (there are 3):

from = blend_node(blend_points[closest].name, blend_points[closest].node, p_time, true, 0.0, FILTER_IGNORE, false) - length_internal;

should be:

from = length_internal - blend_node(blend_points[closest].name, blend_points[closest].node, p_time, false, 0.0, FILTER_IGNORE, false);

I don't know why length_internal was being subtracted from the result of blend_node. Nor why the p_seek param was set to true.
and:

mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, 1.0, FILTER_IGNORE, false) + from;

should be:

mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, 1.0, FILTER_IGNORE, false);

Because from is added to mind in the next line again.
All of this was causing length_internal to skyrocket to inf and flipflop between negative and positive when switching animations.

I'll make a PR.

@akien-mga akien-mga added this to the 4.0 milestone May 3, 2021
rune-scape added a commit to rune-scape/godot that referenced this issue May 25, 2021
@archead
Copy link

archead commented Jan 9, 2024

This issue seems to have returned in v4.2.1.stable.official [b09f793].

I can replicate this issue in my personal project and by also running the DiscreteCarryBug.zip that is provided above and porting it to latest Godot 4.0 version.

This was previously fixed in #48375

@JF-Werewolf
Copy link

Can confirm.
I'm using 4.2.2 stable and carry is acting exactly like discrete. Found some reports online of people experiencing the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants