Represents an oriented bounding box (OBB) in 3D space.
OBB is an addon, and must be imported explicitly, see Installation#Addons.
import { OBB } from 'three/addons/math/OBB.js';
Constructs a new OBB.
center
The center of the OBB.
halfSize
Positive halfwidth extents of the OBB along each axis.
rotation
The rotation of the OBB.
The center of the OBB.
Positive halfwidth extents of the OBB along each axis.
The rotation of the OBB.
Applies the given transformation matrix to this OBB. This method can be used to transform the bounding volume with the world matrix of a 3D object in order to keep both entities in sync.
matrix
The matrix to apply.
Returns: A reference of this OBB.
Clamps the given point within the bounds of this OBB.
point
The point that should be clamped within the bounds of this OBB.
target
The target vector that is used to store the method's result.
Returns:
Returns a new OBB with copied values from this instance.
Returns: A clone of this instance.
Returns true if the given point lies within this OBB.
point
The point to test.
Returns:
Copies the values of the given OBB to this instance.
obb
The OBB to copy.
Returns: A reference to this OBB.
Returns true if the given OBB is equal to this OBB.
obb
The OBB to test.
Returns: Whether the given OBB is equal to this OBB or not.
Defines an OBB based on the given AABB.
box3
The AABB to setup the OBB from.
Returns: A reference of this OBB.
Returns the size of this OBB.
target
The target vector that is used to store the method's result.
Returns: The size.
Performs a ray/OBB intersection test and stores the intersection point in the given 3D vector.
ray
The ray to test.
target
The target vector that is used to store the method's result.
Returns: The intersection point. If no intersection is detected, null is returned.
Returns true if the given AABB intersects this OBB.
box3
The AABB to test.
Returns:
Returns true if the given OBB intersects this OBB.
obb
The OBB to test.
epsilon
A small value to prevent arithmetic errors.
Default is Number.EPSILON.
Returns:
Returns true if the given plane intersects this OBB.
plane
The plane to test.
Returns: Whether the given plane intersects this OBB or not.
Returns true if the given ray intersects this OBB.
ray
The ray to test.
Returns: Whether the given ray intersects this OBB or not.
Returns true if the given bounding sphere intersects this OBB.
sphere
The bounding sphere to test.
Returns:
Sets the OBBs components to the given values.
center
The center of the OBB.
halfSize
Positive halfwidth extents of the OBB along each axis.
rotation
The rotation of the OBB.
Returns: A reference to this OBB.