n-container

altspace/components. n-container

A container keeps a running tally of how many objects are within its bounds, and adds and removes the states container-full and container-empty based on the current count of objects. Requires a native collider component set to trigger mode.

Example
<a-box n-box-collider="isTrigger: true" n-container="capacity: 6"></a-box>

Extends

Members

capacity :number

The value at which the container will fire the container-full event.

Default Value:
  • 4

(readonly) count :int

The number of objects in this container.

Events

container-count-changed

Fired every time an object enters or leaves the bounds of the n-container.

Parameters:
Name Type Description
event Object

Contains details of the event. The new object count can be found at event.detail.count.

container-empty

Fired when the n-container reaches zero objects contained.

container-full

Fired when the n-container reaches its capacity.