Back to Aframe

obb-collider

docs/components/obb-collider.md

1.7.11.9 KB
Original Source

Collision system using Oriented Bounding Boxes based on THREE.OBB.

It checks collision across all entities with the obb-collider component. It emits events when bounding boxes start and stop intersecting.

Example

html
<a-entity obb-collider></a-entity>

Set showColliders to true on the scene to render colliders for debugging purposes:

html
<a-scene obb-collider="showColliders: true"></a-scene>

Properties

PropertyDescriptionDefault Value
sizeForce collider to a specific size0 0 0
trackedObject3DVariable path to the object3D used to calculate the collider. el.object3D by default''
minimumColliderDimensionMinimum dimension size for the collider. Not practical if too small. e.g planes or small models0.02
centerModelCenters the model before calculating the bounding box and corresponding collider.false

Events

Event NameDescription
obbcollisionstartedEmitted on the entities that start colliding. Event detail will contain withEl referencing the entity that has collided with.
obbcollisionendedEmitted on the entities that stop colliding. Event detail will contain withEl referencing the entity that was colliding with