Here is an example project:
https://playcanvas.com/project/1155525/overview/bounding-box-collider
const bb = new pc.BoundingBox();
const renders = this.entity.findComponents('render');
const min = new pc.Vec3();
const max = new pc.Vec3();
for (const render of renders) {
const aabb = render.meshInstances[0].aabb;
const imin = aabb.getMin();
const imax = aabb.getMax();
min.min(imin);
max.max(imax);
}
bb.setMinMax(min, max);
const t = this.entity.getWorldTransform().clone().invert();
const center = bb.center.clone();
t.transformPoint(center, center);
this.entity.addComponent('collision', {
halfExtents: bb.halfExtents,
linearOffset: center
});