The Box3.intersectsPlane()
method is used to check whether a three-dimensional bounding box intersects with a plane or not. It returns true
if the box intersects with the plane, otherwise false
.
Box3.intersectsPlane(plane)
plane
: The plane to check for intersection with the box. It should be an instance of the THREE.Plane class.
The method returns a Boolean value. If the box intersects with the plane, it returns true
. Otherwise, it returns false
.
const box = new THREE.Box3(new THREE.Vector3(-1, -1, -1), new THREE.Vector3(1, 1, 1));
const plane = new THREE.Plane(new THREE.Vector3(0, 1, 0), 0);
const intersects = box.intersectsPlane(plane);
console.log(intersects); // true
In the above example, a box is created with a range from -1 to 1 on all three axes. A plane is then created, representing the xz-plane at y=0. The intersects
variable is assigned the result of calling the intersectsPlane()
method, which returns true
since the box does intersect with the plane.
THREE.Box3
class and can only be called on instances of that class.