GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

3D model animation actions/conditions

Open HelperWesley opened this issue 1 year ago • 8 comments

Description

There isn't currently a way to restart an animation that is already playing. With 2D sprites you can set the frame of the animation back to 0. But that isn't the case with 3D models.

Solution suggested

Allow animations to be restarted in the same way as sprite animations.


(Edit: The animation can be restarted by switching the animation to something else before changing it to the one you want to use, but this is sort of a "hack" solution. It would be better if the time elapsed action worked as consistently as the frame action, allowing users to reset animations during and after the animation has finished playing.)

HelperWesley avatar Sep 12 '24 16:09 HelperWesley

@HelperWesley @4ian Is this still available? If so, I would like to contribute

stanikeva avatar Sep 16 '24 21:09 stanikeva

@stanikeva Yes please, you're welcome to contribute a PR to add this :)

4ian avatar Sep 17 '24 10:09 4ian

I would like to contribute

Ahmad986Ferdaws avatar Sep 17 '24 14:09 Ahmad986Ferdaws

Feel free to start working on an issue, no need to ask for permission (though discussion can be useful if it's a complex problem) :)

4ian avatar Sep 17 '24 14:09 4ian

@HelperWesley, @4ian Good evening, could you please provide a bit more information about this issue? Maybe where in the pipeline this feature is implemented in the 2D sprites so we can start from there? Also maybe where would this new implementation go in the code? Thank you for your time!

kitsiosvas avatar Sep 21 '24 17:09 kitsiosvas

There isn't currently a way to restart an animation that is already playing. With 2D sprites you can set the frame of the animation back to 0, or switch to a different animation and then back to the one you want to restart. But that isn't the case with 3D models.

Actually, the following action can be used on any object that has animations:

image

D8H avatar Sep 21 '24 21:09 D8H

@D8H @kitsiosvas

The elapsed time action doesn't work once an animation has finished playing, so it's inconsistent, and doesn't work as consistently as the frames action does for 2D sprites.

https://github.com/user-attachments/assets/19349bff-3ccc-4cf7-8774-dc4dcfb3b8e6

HelperWesley avatar Sep 22 '24 13:09 HelperWesley

@HelperWesley thanks for the analysis. If you still have the project, sending it here would be a great addition to the issue for contributors to have a reproductible bug. @kitsiosvas @stanikeva @Ahmad986Ferdaws I think you have everything to submit a PR:

  • The action that should work (you can search the sentence in the codebase in order to get the function that is executed in game)
  • The fact that it does work for Sprites but not 3D models (both are Animatable objects) so it can be considered as a bug. Plus you can have a look at the sprite object way of doing things to get ideas about how to fix this for 3D models.

AlexandreSi avatar Oct 07 '24 13:10 AlexandreSi

Closing this since I think it's been fixed in the latest release. Feel free to re-open if there is still an issue.

AlexandreSi avatar Oct 25 '24 16:10 AlexandreSi