The project has a helper script with a function that loads a GLB as a container asset from a URL that you can use to create an entity from at runtime. Look at glb-utils.js in the project.
I have an entity ‘Model’ and added a script
getting
Cannot read properties of undefined (reading ‘addChild’)
var Test = pc.createScript('test');
// initialize code called once per entity
Test.prototype.initialize = function() {
this.model = this.app.root.findByName('Model');
var app = this.app;
var test = new pc.Entity();
app.assets.loadFromUrl('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/2CylinderEngine/glTF-Binary/2CylinderEngine.glb', 'container', function(err, asset) {
test.addComponent('model', {
type: 'asset',
asset: asset.resource.model,
});
this.model.addChild(test);
});
};
// update code called every frame
Test.prototype.update = function(dt) {
};
// swap method called for script hot-reloading
// inherit your script state here
// Test.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// https://developer.playcanvas.com/en/user-manual/scripting/
Chances are that entity that you are adding this new entity to as a child is scaled/rotated in some way that it doesn’t look like it has appeared/rendered in the scene
Hi @yaustar I am a bit confused with the binary asset
As this project loads the models in two ways
one thru Asset and other thru Link
The binary asset of the Damaged Helmet is been added
I am trying to make/convert my model into a binary. But i am unable to do it
Please help me convert any model Glb into a Binary Asset and make it work with this project