[SOLVED] Prevent model from loading if collision is out of bounding box?

Hi there, so I have a plane entity with a bounding box

var Aabb = pc.createScript('aabb');

// initialize code called once per entity
Aabb.prototype.initialize = function () {
    this.aabb = new pc.BoundingBox(new pc.Vec3(3, 1, 2), new pc.Vec3(5, 3, 2));
};

And a model entity

var LoadGlbExternalContainer = pc.createScript('loadGlbExternalContainer');

// initialize code called once per entity
LoadGlbExternalContainer.prototype.initialize = function() {
    var app = this.app;
    var self = this;

    app.assets.loadFromUrlAndFilename('https://threejs.org/examples/models/gltf/Soldier.glb', null, "container", function (err, asset) {
        // Add the loaded scene to the hierarchy
        self.entity.addComponent('model', {
            asset: asset.resource.model
        });

               self.entity.addComponent('collision', {
        type: 'mesh',
         asset: asset.resource.model
    });
    
   self.entity.addComponent('rigidbody', {
        type: pc.BODYTYPE_KINEMATIC
    });
         
        if (asset.resource.animations.length > 0) {
            self.entity.addComponent('animation', {
                assets: asset.resource.animations    
            });
        }
    });
};

// update code called every frame
LoadGlbExternalContainer.prototype.update = function(dt) {
    
};

Is there any way to prevent model from loading if the collision of the model is outside of the bounding box? PlayCanvas | HTML5 Game Engine

You will have to know the size of the model ahead of time to compare if you want to check BEFORE you load the asset. This means you have to store this ‘metadata’ somewhere ahead of time before you download the model file(s)

Thanks, I’ll have to find a better way, we can mark this as solved