Skip to main content

<boxes>

Renders a group of instanced boxes in a single draw call.

This is almost identical to <box> but allows you to provide multiple transforms. The number of boxes rendered is anchored to the size of the positions array. The rotations and scales arrays are cyclical, so if they all have the same rotation/scale you can just enter a single value in those props.

When placed inside a <rigidbody> they gain physical properties.

Props

PropTypeDescriptionDefault
sizeNumber|ArraySize of the box. Use an array to control width, height, depth separately.1
colorStringColor of the box.0xededed
opacityNumberOpacity of the box.1
countNumberThe maximum number of instances1000
positions[...Array]Positions of each box.[[0,0,0]]
rotation[...Array]Rotations of each box. Cyclical.[[0,0,0]]
scale[...Number|Array]Scales of each box. Use a single numeric value for scalar. Cyclical.[1]
onHoverEnterFunctionCalled when an avatar hovers over a box. Provides an Event
onHoverLeaveFunctionCalled when an avatar hovers out of a box. Provides an Event
onPointerDownFunctionCalled when avatar presses the pointer down over this object.
onPointerDownHintStringText displayed when hovering over this object when onPointerDown is defined.
onPointerUpFunctionCalled when avatar releases the pointer over this object.
onPointerUpHintStringText displayed when hovering over this object with the pointer down and onPointerUp is defined.
hitDistanceNumberMaximum distance to interact with this node.3
hiddenBooleanWhether to hide the boxes. Use this for an invisible physics boxes.false
climbableBooleanWhether avatars can climb the boxes when placed inside a <rigidbody>

Ref

FieldDescription
setPosition(idx, vec3)Update position of a box
setRotation(idx, eul)Update rotation of a box
setScale(idx, vec3)Update scale of a box

Notes

None.