Hi everyone,
In my WebAR app, I’m trying to update a component on one of my entities: ecs.GltfModel(..)
, specifically its url
property to load a new model.
I have a reset function that is called at some point to update the GltfModel’s “url” and play its animation:
const handleReset = (event, world, component) => {
const {data: {url, clip}} = event
const {eid} = component
handlePause(component)
handleGrowing(component, false)
// Load a new Mushroom component
// ecs.GltfModel.mutate(world, eid, (cursor) => {
// cursor.url = url
// cursor.animationClip = 'Jump'
// cursor.repetitions = -1
// })
const currentModel = ecs.GltfModel.cursor(world, eid)
currentModel.url = url
currentModel.animationClip = clip
currentModel.repetitions = -1 // forever loop
}
The new model is loaded, but the animation clip is never playing on this newly loaded model (clip is always defined with the expected value). I tested using cursor
, mutate
, and acquire
/commit
, but I can’t get the animation to play. I also did try to ecs.GltfModel.remove(..)
and then ecs.GltfModel.set(..)
but the animation is not playing.
I noticed an error happening when updating GltfModel url and playing a new animation. THREE.PropertyBinding: Trying to update node for track: Head2.position but it wasn't found.
It seems this error could be related to the fact that some parts of the previous GLTF model, are not fully disposed. Is there something I can do to fix this issue? Thank you.