BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Box3.intersectsPlane()

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.

Syntax

Box3.intersectsPlane(plane)

Parameters

plane: The plane to check for intersection with the box. It should be an instance of the THREE.Plane class.

Return value

The method returns a Boolean value. If the box intersects with the plane, it returns true. Otherwise, it returns false.

Examples

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.

Notes

  • This method is a part of the THREE.Box3 class and can only be called on instances of that class.
  • The box is considered to be intersecting with a plane if any part of the box lies on the positive side of the plane.
  • The function performs an intersection test based on the AABB (axis-aligned bounding box) of the box, which can sometimes return false positives or negatives in certain cases. In such cases, other intersection tests like the SAT (separating axis test) may be more appropriate to use.

References