API Reference

Class List

pc.OrientedBox

Oriented Box.

Summary

Properties

worldTransformThe world transform of the OBB

Methods

containsPointTest if a point is inside a OBB.
intersectsBoundingSphereTest if a Bounding Sphere is overlapping, enveloping, or inside this OBB.
intersectsRayTest if a ray intersects with the OBB.

Details

Constructor

OrientedBox([worldTransform], [halfExtents])

Create a new oriented box.

Parameters

worldTransformpc.Mat4Transform that has the orientation and position of the box. Scale is assumed to be one.
halfExtentspc.Vec3Half the distance across the box in each local axis. The constructor takes a reference of this parameter.

Properties

pc.Mat4worldTransform

The world transform of the OBB

Methods

containsPoint(point)

Test if a point is inside a OBB.

Parameters

pointpc.Vec3Point to test.

Returns

Boolean true if the point is inside the OBB and false otherwise.

intersectsBoundingSphere(sphere)

Test if a Bounding Sphere is overlapping, enveloping, or inside this OBB.

Parameters

spherepc.BoundingSphereBounding Sphere to test.

Returns

Boolean true if the Bounding Sphere is overlapping, enveloping or inside this OBB and false otherwise.

intersectsRay(ray, [point])

Test if a ray intersects with the OBB.

Parameters

raypc.RayRay to test against (direction must be normalized).
pointpc.Vec3If there is an intersection, the intersection point will be copied into here.

Returns

Boolean True if there is an intersection.