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

PackedVector2Array reset when animated with cubic interpolation #69188

Open
IntangibleMatter opened this issue Nov 25, 2022 · 3 comments
Open

Comments

@IntangibleMatter
Copy link
Contributor

Godot version

4.0 beta 6

System information

Windows 10

Issue description

When a PackedVector2Array is animated by an AnimationPlayer on a track with continuous playback and cubic interpolation enabled, the Array is set to have a size of 0 for all keyframes except the final one. When looped, all keyframes set it to have a size of 0. Ping-Pong playback still displays only the final keyframe.

Steps to reproduce

  1. Create a scene with an object that uses a PackedVector2Array (eg. Polygon2D, CollisionPolygon2D, etc.) and an AnimationPlayer
  2. Add keyframes which animate the PackedVector2Array
  3. Set the track to play continuously and to have cubic interpolation
  4. Play the animation from the start

Minimal reproduction project

PackedVector2Array_anim_erase_beta6.zip

@kleonc
Copy link
Member

kleonc commented Nov 26, 2022

Issue description

When a PackedVector2Array is animated by an AnimationPlayer on a track with continuous playback and cubic interpolation enabled, the Array is set to have a size of 0 for all keyframes except the final one. When looped, all keyframes set it to have a size of 0. Ping-Pong playback still displays only the final keyframe.

@IntangibleMatter And what's the expected behavior?


AFAIK currently interpolating arrays is simply not supported. Would this be solved by #66771? cc @Mickeon

@IntangibleMatter
Copy link
Contributor Author

Issue description

When a PackedVector2Array is animated by an AnimationPlayer on a track with continuous playback and cubic interpolation enabled, the Array is set to have a size of 0 for all keyframes except the final one. When looped, all keyframes set it to have a size of 0. Ping-Pong playback still displays only the final keyframe.

@IntangibleMatter And what's the expected behavior?

AFAIK currently interpolating arrays is simply not supported. Would this be solved by #66771? cc @Mickeon

The expected behaviour is for the array to interpolate with cubic interpolation, which usually looks nicer than linear interpolation. Linear interpolation works perfectly fine. And this is a problem with AnimationPlayers, Tweens aren't relevant in this case (afaik).

@Mickeon
Copy link
Contributor

Mickeon commented Nov 26, 2022

Tweens are relevant. They share the same internal Animation class to animate all Variants.

#66771 is a bit abandoned but I'll get back to it soon-ish. The PR intended to implement blending Packed Arrays with Tweeners, but I was not even accounting for the AnimationPlayer using the same methods (I just forgot it was a possibility), so I'd need to test it there too.

I believe (I cannot confirm right now and I may be wrong) the issue stems from Animation::blend_variant. There's no handling for Packed Arrays so it just falls back to the default behavior:

default: {
return c < 0.5 ? a : b;
}
}

It would probably be a good idea to implement blent_variant for Packed Arrays in the PR, too.

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