Skip to main content

<spheres>

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

This is almost identical to <sphere> but allows you to provide multiple transforms. The number of spheres 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 of a <rigidbody> they gain physical properties.

Props

PropTypeDescriptionDefault
radiusNumberRadius of the sphere.0.5
widthSegmentsNumberNumber of width segments.32
heightSegmentsNumberNumber of height segments.16
colorStringColor of the sphere.0xededed
opacityNumberOpacity of the sphere.1
countNumberThe maximum number of instances1000
positions[...Array]Positions of each sphere.[[0,0,0]]
rotation[...Array]Rotation of each sphere. Cyclical.[[0,0,0]]
scale[...Number|Array]Scales of each sphere. Use a single numeric value for scalar. Cyclical.[1]
onHoverEnterFunctionCalled when an avatar hovers over a sphere. Provides an Event
onHoverLeaveFunctionCalled when an avatar hovers out of a sphere. 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 spheres. Use this for invisible physics spheres.false
climbableBooleanWhether avatars can climb the spheres when placed inside a <rigidbody>

Ref

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

Notes

None.