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

StateMachine has delay which is caused by transition from Start to the first state needs one frame #91215

Open
Watersilver opened this issue Apr 26, 2024 · 1 comment

Comments

@Watersilver
Copy link

Tested versions

  • Reproducible in: 4.2.2.stable

System information

Windows 10

Issue description

Animation in state machine that is configured to play only once and then transition to another animation lags for a few ticks on its final frame.

When I set callback_mode_process to manual and make multiple animation tree advance calls though lag gets reduced and starting at five times there is not lag at all.

Expected: When animation ends instantaneously move to next animation without lag.

Steps to reproduce

When you run the MRP the output prints the animation, its frame and how many ticks the frame lasted.

When you turn around until the run_turn animation transitions to the run animation you should see something like: player run turn | frame: 7 | lasted: 6 This is the final frame of the player run turn animation and the correct non laggy version.

Select the player character scene and change the anim_tree_advance_steps property to select how many times to call the animation tree advance method.

If you set it to 1 the behavior is the same as if we didn't use the manual animation tree advance method and callback_mode_process was set to idle or physics.

now if you turn around again to transition from run_turn -> run you will probably feel the delay between the transition but if not you should see something like: player run turn | frame: 7 | lasted: 8 = Two ticks of lag for the final frame of the player run turn animation.

I get these results consistently. 6 for non laggy version 8 for laggy but it might be machine dependent.

Minimal reproduction project (MRP)

AnimTreeIssues.zip

@TokageItLab
Copy link
Member

TokageItLab commented Apr 27, 2024

The end of the State is not delayed, but it seems that the start of the next State is delayed by processing one frame to transition from the Start state to the first state. I assume that we can eliminate this delay if the transition is not broken.

The MRP in follow indicates that a total of 10 frames of animation progressing at 1 FPS, but if there are two layers in the StateMachine, it will take 12 frames to end.

state_frame.zip

@TokageItLab TokageItLab added this to the 4.x milestone Apr 27, 2024
@TokageItLab TokageItLab changed the title Animation tree state machine switch_mode: at_end transition 2 frames lag StateMachine has delay which is caused by transition from Start to the first state needs one frame Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants