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

Plane.intersectsBox()

The Plane.intersectsBox() method in Three.js is used to check for the intersection between a plane and a bounding box. This method can be particularly useful in games or simulators, where you may need to detect if an object is within a specific area.

Syntax

The function takes a single argument, which is the Box3 object you wish to check for intersection against.

intersectsBox( box: Box3 ): boolean

Parameters

  • box - The Box3 object to check intersection against.

Return Value

True if the plane intersects with the bounding box, false otherwise.

Example

In this example, we create a plane and bounding box to check for intersection. We then call Plane.intersectsBox() to detect whether the two intersect.

const plane = new THREE.Plane( new THREE.Vector3( 0, 1, 0), 0 ); // A plane with normal vector (0,1,0) and distance from origin 0
const box = new THREE.Box3( new THREE.Vector3( -1, -1, -1 ), new THREE.Vector3( 1, 1, 1 ) ); // A bounding box with minimum and maximum coordinates
const intersects = plane.intersectsBox( box ); // Returns true if intersecting, false otherwise

Conclusion

The Plane.intersectsBox() method in Three.js is a simple and efficient way to check for intersection between a plane and a bounding box. If used correctly, it can be a powerful tool in your development arsenal.