I’ve got a hierarchy of objects under a top level entity.
I’ve made a bbox to fit:
var option = new pc.BoundingBox();
option.copy(top_node.model.meshInstances[0].aabb);
this.aabb.push([option, top_node]);
and it all works perfectly (correct size too) when I loop through the bboxes doing a ray test:
...
var sel = [];
for(var i=0; i < bboxes.length; i++) {
bbox = bboxes[i];
if (bbox[1].enabled) {
entity = bbox[0].intersectsRay(this.ray, thispoint);
if (entity) {
sel.push(bbox[1]);
}
}
}
(which is really great btw.)
However - if I translate the group above my top_nodes then my bbox does not move.
Ideally I should attach the bbox somehow under the top_node but its not an Entity.
I have tried adding it as a collision component but not working. I could remake the bboxes whenever I move (but lots of garbage).
What’s the best way to have my pc.BoundingBox() be transformed in the scene tree ?