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.applyMatrix4()

The Box3.applyMatrix4() method in Three.js applies a Matrix4 transformation to the bounding box.

Syntax

box.applyMatrix4(matrix);

Parameters

  • matrix - The Matrix4 transformation to apply to the box.

Description

To transform a box, create a Matrix4 representing the transformation and call applyMatrix4(matrix) on the box.

var box = new THREE.Box3(
  new THREE.Vector3(-1, -1, -1),
  new THREE.Vector3(1, 1, 1)
);

var matrix = new THREE.Matrix4();
matrix.makeTranslation(1, 0, 0);

box.applyMatrix4(matrix);

In the example above, a new Box3 object is created with two corner vectors, representing a cube centered around the origin. A Matrix4 is created and translated one unit along the X-axis. Finally, the box is transformed by the matrix.

Note that this method does not modify the original bounding box, but returns a new bounding box with the transformed corners.

Examples

API Reference