Hello!
I ran example for c++ - "gltf_viewer", I can see my model, and if the model has animation, it starts automatically and it works fine.
I鈥檓 trying to do the same without using FilamentApp, that's possible, right?
I can load the model, but I can鈥檛 run the animation, how can I do that?
maybe exist some instruction/guide or another example?
The following is an example of the JavaScript API for your reference.
https://github.com/google/filament/blob/main/web/samples/animation.html#L75-L79
if (this.animator) {
const ms = Date.now() - this.animationStartTime;
this.animator.applyAnimation(0, ms / 1000);
this.animator.updateBoneMatrices();
}
If you have multiple animations included, the following may be helpful.
https://github.com/cx20/gltf-test/blob/master/examples/filament/index.js#L163-L166
if (this.animator) {
const ms = Date.now() - this.animationStartTime;
for (let i = 0; i < this.asset.getAnimator().getAnimationCount(); i++ ) {
this.animator.applyAnimation(i, ms / 1000);
this.animator.updateBoneMatrices();
}
}
thank you!
it is a great example, and I found another useful example
https://github.com/google/filament/blob/dcca236f6058b61a9a6aa07bfe4ac53b1cdd05e5/libs/gltfio/include/gltfio/AssetLoader.h#L80-L120
maybe it will be useful for somebody else
Most helpful comment
The following is an example of the JavaScript API for your reference.
https://github.com/google/filament/blob/main/web/samples/animation.html#L75-L79
If you have multiple animations included, the following may be helpful.
https://github.com/cx20/gltf-test/blob/master/examples/filament/index.js#L163-L166