I’m trying to make a collision system using Box3.
Each player have their meshes in a group (this.group), red on the gif.
In the constructor of the Player class, I create the AABB box using
setFromObject which is white on the gif.
this.hitbox = new THREE.Box3().setFromObject(this.group); this.hitboxHelper = new THREE.Box3Helper(this.hitbox, new THREE.Color('#ffffff')); this.group.add(this.hitboxHelper);
In a setInterval loop (to simulate frame update loop and avoid spamming in case of problems), I make
setFromObject again to update positions and then have accurate collisions.
But, when I change the positions or the rotation of the group, the hitbox have a weird behavior :
What I’m doing wrong ?