Hi ,
I have more than 100 cubes in my scene
I have to be able to select each one with Mouse
But adding rigidbody to this number of cubes and using raycast to select them , reduced the fps on lower devices
I want to use this project, to do this without rigidbody and physics
But when I rotate the cubes, this code again takes into account the cube that did not rotate
I even changed the code using this solution
BoundingBoxShape.prototype.initialize = function () {
// Create the AABB and move the position of the box by the offset
this.aabb = new pc.BoundingBox(this.entity.getPosition(), this.halfExtents);
};
BoundingBoxShape.prototype.postInitialize = function () {
this.app.fire("shapepicker:add", this.entity, this.aabb);
};
BoundingBoxShape.prototype.postUpdate = function (dt) {
this.aabb.center.copy(this.entity.getPosition());
this.aabb.halfExtents.copy(this.halfExtents);
this.aabb = this.entity.render.meshInstances[0].aabb;
};
But it does not work properly when rotating the cubes