4

In Blender, I modeled, textured and animated an idle animation for a simple robot character for a game in Godot. Using the Blender-gltf exporter by KhronosGroup, I successfully exported the mesh, material and animation into one .glb file, and then successfully imported it into Godot 3.0.3. with no problems.

I selected the Autoplay on Load button, as well enabling looping by selecting its respective button. When I ran the game however, the animation did indeed play on load but it did not loop. For Collada imports, pressing the loop button is all it would take to make it loop. Is there something different about .gltf/.glb files that makes the loop option not work?

I have searched extensively through the documentation for Godot, gltf-exporter, as well as several google searches and tutorials, but none seem to cover this problem as most people use Collada (.dae) files. But for separate reasons I want to use .glb files if possible. I also want to avoid having to force the looping property with code but if that is the only possibility then that's how it is.

EDIT:
I finally found a function called set_loop(bool) that sets whether an animation loops, allowing looping to be successfully set with this line of code:
$AnimationPlayer.get_animation("Animation_Name").set_loop(true)
However, I would still like to have this be set in the editor if possible; it doesn't really feel like the kind of thing that needs to be set in code.

Carol9009
  • 223
  • 2
  • 12
  • 1
    Does the animation loop when played on https://gltf-viewer.donmccurdy.com/? When exporting from Blender you may need to set the playback range (in Blender's UI) before exporting, or disable the `Export within playback range` option at export, to avoid having extra (empty) frames at the end of the animation. – Don McCurdy Jul 18 '18 at 14:49
  • It looks like the animation does loop on gltf-viewer.donmccurdy.com, probably because I already did set the playback range in Blender. Looks like it is a problem with Godot specifically. – Carol9009 Jul 18 '18 at 15:10
  • Hm ok, sounds likely. – Don McCurdy Jul 18 '18 at 17:42

1 Answers1

1

i had the same problem as you.

First update gltf export addon in Blender. After, in Blender, stash animations in Action Editor. Go in NLA Editor rename animations strips for corresponding animation names. For example "Idle" animation.

In disire animations loops add "-loop" thermology in end strip name.

Finish, exporting gltf with animations. In godot animations with "-loop" thermology, loop in Godot editor will be enabled by default.

It's an old question but I hope it helps new developers.

Bill Rock
  • 43
  • 8