collisions don’t work with this setup and I cant find intelligible api about this case
public static LoadFromUrl(app:pc.Application, url:string, collision: boolean) {
log.pc_shooter('URL', url)
return new Promise<pc.Entity>((resolve) => {
app.assets.loadFromUrl(url, 'container', function(err: any, asset: any) {
const entity:pc.Entity = asset.resource.instantiateRenderEntity({
castShadows: true
})
// entity.addComponent('collision', {
// type: 'mesh',
// renderAsset: asset.resource.model
// })
log.pc_shooter(asset.resource.model, 'asset.resource.model')
entity.addComponent('rigidbody', {
type: 'kinematic',
restitution: .5,
friction: .5
})
entity.addComponent('collision', {
type: 'mesh',
renderAsset: asset.resource.model
})
// app.root.addChild(entity)
// entity.setPosition(pos)
resolve(entity)
})
})
}