Hi everyone,
I’m using Babylon.js Editor 5.5.0 and I’m creating reusable .scene files that I instantiate from another scene.
I have a farmer.scene containing a model with AnimationGroups such as:
-
farmidle -
farmrunning -
farmdie
When I run farmer.scene directly, the AnimationGroup names are exactly as expected.
However, when I instantiate the scene:
const farmer = this._farmer.instantiate();
the AnimationGroup names become something like:
farmdie-65cfd3e7-93cc-4a6a-ade3-f71262128dbb
Because of this, something like:
@animationGroupFromScene("farmdie")
private _die: AnimationGroup | null = null;
returns null.
I can make it work by searching with startsWith():
this._die = this.mesh.getScene().animationGroups.find(
group => group.name.startsWith("farmdie")
) ?? null;
My question is: is this the expected behavior when instantiating a .scene in Babylon.js Editor?
If so, what is the recommended way to reference AnimationGroups from an instantiated scene? Is using startsWith()the correct approach, or is there a better way to keep/reference the original AnimationGroup names?
@julien-moreau Can you help me with this?
Thanks!
Maxi