Skip to content

NgtsCenter

NgtsCenter is a port of Drei’s Center which is a component that calculates a bounding box and center its children accordingly.

Outputs

name type description
centered NgtsCenterState Emits when the component centers its children.

Options

options input accepts any properties from THREE.Group in addition to the following:

Properties

name type description
top boolean Whether to center the children along the top axis.
right boolean Whether to center the children along the right axis.
bottom boolean Whether to center the children along the bottom axis.
left boolean Whether to center the children along the left axis.
front boolean Whether to center the children along the front axis.
back boolean Whether to center the children along the back axis.
disable boolean Disable all axes.
disableX boolean Disable x-axis centering.
disableY boolean Disable y-axis centering.
disableZ boolean Disable z-axis centering.
precise boolean See https://threejs.org/docs/index.html?q=box3#api/en/math/Box3.setFromObject. Default: true
cacheKey any Optional cacheKey to keep the component from recalculating on every render. Default: 0