Can't control model animation loop when in AR mode (Model-Viewer)

Thanks for these extra details. After a bit of experimentation, reviewing code, and reviewing the glTF™ 2.0 Specification, my understanding is that animation looping is not encoded into glTF at all, but rather is expected to be a runtime decision by whatever framework is rendering the glTF. For example, if you import the glTF for your scenario, and in Babylon.js you call play(false) on the single AnimationGroup, this plays the animation one time without any looping.

Given this, I expect the bug is in Google Model Viewer. That being said, please also note that Babylon has a great standalone Viewer that you could also consider using. Currently the primary Viewer API always plays animations in looping mode, but the Babylon Viewer is also extremely customizable and allows full access to the underlying Babylon API. Here is an example that loads a model in the Babylon Viewer and plays the first animation group one time with no looping: https://codepen.io/BabylonJS/pen/zxvqqea

Also note that the Babylon Viewer is constantly being improved, and we could also update the Viewer API to directly support playing animations with or without looping.

You can find more details on the Babylon Viewer here:

4 Likes