Specifically, I’m trying to use the AssetListLoader code to load a GLB model and some animations. In the example the urls for the various assets are static urls. I’m unsure how to correctly get the urls for my assets.
So in the example there is:
model: new pc.Asset("model", "container", {
url: "/static/assets/models/bitmoji.glb",
}),
idleAnim: new pc.Asset("idleAnim", "container", {
url: "/static/assets/animations/bitmoji/idle.glb",
}),
But I’m trying this:
model: new pc.Asset("model", "container", {
url: this.app.assets.find('RPM_Avatar_Steve_01.glb').getFileUrl(),
}),
idleAnim: new pc.Asset("idleAnim", "container", {
url: this.app.assets.find('talkingAnim.glb').getFileUrl(),
}),
But then I get this error:
Uncaught TypeError: Cannot read properties of undefined (reading ‘instantiateRenderEntity’)
So clearly this is not working as intended. What is the correct method here?
Ah OK. I’ve modified the code, but I’ve left it as an object since I need to refer to assets.model and assets.idleAnim further into the code, as per the example.
Not getting any errors, but nothing seems to actually get loaded.
This is more tricky as you have GLBs as binary assets in the project and therefore need to processed differently as we don’t yet support importing GLB files in the Editor.
I’ve fixed all the loading issues in the project which include:
Creating a new asset of container type for the GLB binary
Fixing the state graph JSON
Fixing the animation resource assignment to the anim component
There was also a bug with the AssetListLoader where if all the assets are already loaded, it doesn’t call the done callback which I worked around in the project: https://github.com/playcanvas/engine/issues/4512
It’s strange because Mixamo and ReadyPlayerMe advertise their animations as being compatible with each other, but I guess there’s a retargeting step that needs to be done first.