Hello! I have been playing around with Three.js for a few weeks and I came across this issue which I can’t find any relevant solution or maybe I’m not using the right keyword to search? Coming from a 2D background (using phaser.js) and having no experience with 3D models, what I am trying to achieve is to make a custom bounding box for my 3D game object which is very easy to create in 2D. I created a box around my 3D object like I used to do with my 2D game objects but apparently I’m trying to create a custom bounding box around my 3D model. I don’t know if I have clearly expressed what I’m looking for but I’m attaching a screenshot to show the what I did! Any suggestion will be very helpful. Thanks!
I don’t know what would make your 3D bounding box “custom”.
A regular axis-aligned bounding box is available via:
const box = new THREE.Box3();
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(),
new THREE.MeshBasicMaterial()
);
// ensure the bounding box is computed for its geometry
// this should be done only once (assuming static geometries)
mesh.geometry.computeBoundingBox();
See this for more info: