There is an entity cont in this project, and there is another entity 1P-2-7-m in it. I want to move 1P-2-7-m so that its lower left corner is exactly at the (0,0,0) position of the cont.
I used to get the halfExtents data of boundingbox to make a mobile reference, but I could not align it. Is there any way to achieve the desired effect with code
https://playcanvas.com/project/1139787/overview/model-viewer
function getEntityBoundingBox(entity) {
if(typeof entity == 'string'){
templateEntity=pc.app.root.findByName(entity)
}else{
templateEntity=entity
}
var boundingBox = new pc.BoundingBox();
var i, m, meshInstances = [];
var renders = templateEntity.findComponents("render");
for (i = 0; i < renders.length; i++) {
var render = renders[i];
for (m = 0; m < render.meshInstances.length; m++) {
meshInstances.push(render.meshInstances[m]);
}
}
var models = templateEntity.findComponents("model");
for (i = 0; i < models.length; i++) {
var model = models[i];
for (m = 0; m < model.meshInstances.length; m++) {
meshInstances.push(model.meshInstances[m]);
}
}
for (i = 0; i < meshInstances.length; i++) {
boundingBox.add(meshInstances[i].aabb);
}
return boundingBox;
}