Hi, I´m using PlayCanvas Standalone (without editor)…
I tried to play an animation but nothing ocurring, I think that the problem is how rootBone is assigned or someone has an idea?
When I tried the same in editor, its working fine, but for personal reasons I must use PlayCanvas Standalone.
I extract animations from a GLB asset.
This is the code:
var ChildLod0 = modelEntity.findByName('ChildLOD0');
ChildLod0.render.rootBone = modelEntity;
modelEntity.addComponent('anim', {
activate: true
});
const animations = asset.resource.data.animations;
const animStateGraphData = {
"layers": [
{
"name": "Base",
"states": [
{
"name": "START"
},
{
"name": "Idle",
"speed": 1.0,
"loop": true
}
],
"transitions": [
{
"from": "START",
"to": "Idle",
"time": 0.0,
"priority": 0
}
]
}
],
"parameters": {}
};
modelEntity.anim.loadStateGraph(animStateGraphData);
if (animations && animations.length > 0) {
modelEntity.anim.assignAnimation('Base', 'Idle', animations[0]);
modelEntity.anim.setTrigger('Idle');
} else {
console.error('No animations found in the GLB file.');
}
Using reference: api