Hi everyone,
I am having some problems at loading a glb mesh with collision to use with the raycaster.
I am not using the editor but playcanvas engine.
This is the snippet of code where I am trying to load the mesh:
let meshAsset = new pc.Asset('mesh', 'container', { url: '/mesh.glb' });
await new Promise<void>((resolve) => {
new pc.AssetListLoader([meshAsset], this.app.assets).load(() => resolve());
});
const entity = meshAsset.resource.instantiateRenderEntity();
this.app.root.addChild(entity);
entity.addComponent('rigidbody', {
type: 'static'
});
entity.addComponent('collision', {
type: 'mesh'
});
The mesh is loaded correctly, I see it in the right position, but the raycasting is not working.
If I try to use a different collision type, like a box, it works.
Any idea on what I am doing wrong?
Thanks