Skip to content

Pivot and rotation axis

Some models are exported with their origin far from visible geometry. Model Lab can move the effective axis without modifying vertices or invalidating embedded animations.

Authoring methods

  • Imported origin: use [0, 0, 0].
  • Bounds center: calculate the center of transformed renderable geometry.
  • Exact point: enter any local XYZ coordinate.
  • Pick on model: raycast a visible surface or point-cloud point.

Preserve visual position

Changing the pivot changes the content offset. preserveVisualPosition compensates the outer model position so the rendered asset does not jump.

ts
const next = setViewerPivot(config, [1.25, 0.4, -2], {
  preserveVisualPosition: true,
})

The utility also compensates every sequence keyframe's model position, preserving an existing animation path.

Center through the editor ref

ts
editorRef.current?.centerPivot({
  preserveVisualPosition: true,
})

Runtime hierarchy

tsx
<ModelPivotGroup
  pivot={preset.viewer.pivot.point}
  position={preset.viewer.model.position}
  rotation={preset.viewer.model.rotation}
  scale={preset.viewer.model.scale}
>
  <primitive object={gltf.scene} />
</ModelPivotGroup>

Common mistake

Do not set the pivot to a world coordinate. pivot.point is expressed in the imported model's original local coordinate system.

Released under the MIT License.