I’ve a got a glb asset, created from loading in an FBX.
If I create an instance of it by using a model component, everything is fine. If I create an instance of it by using a render component, I can’t transform it and it stays fixed at (0, 0, 0).with its default rotation and scale.
Here’s the relevant code:
let glbAsset = this.app.assets.find('myGlbAsset');
let newEntity = new pc.Entity(); // Create an Entity
newEntity.addComponent("model", { asset: glbAsset} );
newEntity.setPosition(1, 2, 3);
this.app.root.addChild(newEntity);
The above code will result in the model being positioned at (1, 2, 3);
let glbAsset = this.app.assets.find('myGlbAsset');
let newEntity = new pc.Entity();
newEntity.addComponent('render', { type: 'asset', meshInstances: glbAsset.resource.meshInstances });
newEntity.setPosition(1, 2, 3);
this.app.root.addChild(newEntity);
The above code will result in the model being positioned at (0, 0, 0);
Is there something I’m misunderstanding about the render component works?