Very odd bug with AnimationTree

Environment Info

Godot v4.4.stable - Windows 10 (build 19045) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated AMD Radeon RX 5600 XT (Advanced Micro Devices, Inc.; 32.0.12033.1030) - AMD Ryzen 9 3900X 12-Core Processor (24 threads)

Question

This is an extremely odd issue I’m having, but I’ll try to explain it the best I can.
I’m pretty sure it’s a bug, but just wanted to check here befor I report in case anyone is having the same issue?


What I’m trying to implement

So the feature I’m trying to implement, is multiplying the movement speed of an entity accross it’s entire animation length (based on a curve).

e.g. The entity would start at 40% movement speed, but towards the middle of the animation, it gets sped up to 100%, then back down at the end of the animation:

2 Quick Notes

  1. I tried getting the playhead position of the AnimationPlayer node, but since I have a Time Scale node in my blend tree, the length of the animation is different between the AnimationPlayer and the AnimationTree. This is why I have to use the state machine’s methods.
  2. I thought about directly altering the movement speed by simply keying in a value in the animation directly, but I’d then have to do this for all 8 direction animations, so I figured using a separated curve is easier.

Anyway, here’s the code I came up with:

if sync_movement_to_anim_curve:
	var current_play_position: float = state_machine.get_current_play_position()
	var current_length: float = state_machine.get_current_length()
	var animation_progress: float = current_play_position / current_length
	movement_speed *= anim_movement_curve.sample(animation_progress)

The Issues

It’s also important to note that I’m not experiencing any warnings, errors or crashes, and all the values are correct when debugging.

Thanks for reading this all if you’ve gotten this far; sorry for the wall of text!
Any input would be greatly appreciated though :slight_smile:
Again, I’m pretty sure this is a bug, but would love to hear if anyone has any insight.

Thanks!

UPDATE

The issue seems to be with the get_current_length() function (link to docs).

Even calling it by itself in the ready function produces the same issues.

I’m going to report this as a bug, and get the animation length a different way for now :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.