
Mirror Engine API / OrientedBox
Class: OrientedBox
Oriented Box.
Constructors
new OrientedBox()
new OrientedBox(worldTransform?: Mat4, halfExtents?: Vec3): OrientedBox
Create a new OrientedBox instance.
Parameters
worldTransform?
Mat4
= ...
Transform that has the orientation and position of the box. Scale is assumed to be one. Defaults to identity matrix.
halfExtents?
Half the distance across the box in each local axis. Defaults to (0.5, 0.5, 0.5).
Returns
worldTransform
Get Signature
get worldTransform(): Mat4
Gets the world transform of the OBB.
Returns
Set Signature
set worldTransform(value: Mat4): void
Sets the world transform of the OBB.
Parameters
value
Returns
void
Methods
containsPoint()
containsPoint(point: Vec3): boolean
Test if a point is inside a OBB.
Parameters
point
Point to test.
Returns
boolean
True if the point is inside the OBB and false otherwise.
intersectsBoundingSphere()
intersectsBoundingSphere(sphere: BoundingSphere): boolean
Test if a Bounding Sphere is overlapping, enveloping, or inside this OBB.
Parameters
sphere
Bounding Sphere to test.
Returns
boolean
True if the Bounding Sphere is overlapping, enveloping or inside this OBB and false otherwise.
intersectsRay()
intersectsRay(ray: Ray, point?: Vec3): boolean
Test if a ray intersects with the OBB.
Parameters
ray
Ray to test against (direction must be normalized).
point?
If there is an intersection, the intersection point will be copied into here.
Returns
boolean
True if there is an intersection.