put it in the sandbox, all is good: sandbox. babylonjs. com
but can anyone write the code to load it in and play an animation???
i tried reverse engineering the sandbox, but it’s too minified, idk.
even the playground example of animations fails to find the animations. https://playground.babylonjs.com/#LL5BIQ#0
just switch to the soldier model. skeleton.getAnimationRanges() goes from an array of stuff to an empty array
i’m using nilooy. github. io /mixamo-animation-combiner/ to generate my models. but that soldier one is provided by threejs. same issues with both
Here is the just basic example with this model - https://playground.babylonjs.com/#AJA5J6#7
For animation there is simple function in the code: load(x, z, 3)
where the last parameter is the index of animationGroups array
(for example, load(x, z, 1) will make the bot running).
You can tweak this function as you like, and also don’t forget about Documentation - Bones and Skeletons | Babylon.js Documentation
okay so, that’s great, thanks!!! BUT, loading the model multiple times does actually make multiple network requests, babylon doesn’t cache the load. how to you properly clone the model? it seems extremely complicated to do because the animations don’t copy over
Above was just example function how it is possible to use animationGroups.
Here is the example of instancing models (you load it only once) with animations - https://playground.babylonjs.com/#0K8EYN#0
Note that latest example from @labris does not work in 5.0 because by default the meshes are now instanciated and not cloned when using instantiateModelsToScene. Use the options parameter to for cloning, as in 4.2:
this seems surprisingly slow. 100 models in the scene kills the fps. even with animations disabled. i know JS is slow, but where are the resources going? my GPU is chillin. youtube uses more of my gpu than this playground yet it’s crawling https://playground.babylonjs.com/#AJA5J6#79
If you need better FPS for 100 models - use instances like here https://playground.babylonjs.com/#AJA5J6#80 (but they will have the same animation in this case).
There are other ways to optimize performance too.