[SOLVED] Calculate bounding box of a model

There isn’t an API function to do this, no. However, this should work:

var meshInstances = this.entity.model.meshInstances;
if (meshInstances.length > 0) {
    var bbox = new pc.BoundingBox();
    bbox.copy(meshInstances[0].aabb);
    for (var i = 1; i < meshInstances.length; i++) {
        bbox.add(meshInstances[i].aabb);
    }
}

The docs for pc.BoundingBox are here.

2 Likes