meshfx // GLB PIVOT

How to fix the pivot point of a GLB file

You fix a GLB's pivot by moving the mesh relative to its node's origin, because glTF has no separate pivot: each node's translation, rotation and scale act around that origin. Set the origin where you want it in your 3D editor and export again, or add a parent node in the engine and offset the model inside it.

pyrofx effects work today, and new accounts start with $5 of usage.

MODULE // meshfx AVAILABLE

meshfx measures faults, checks repairs and makes LODs for a triangle budget. meshfx runs on the hosted API: try it in the Playground.

  • glTF pivot: the node origin
  • No pivot field, so the vertices move instead
  • Or offset the model inside a parent node

01 // HOW GLTF STORES IT

Where a glTF pivot lives

Every glTF node has a translation, rotation and scale, or one matrix, and the mesh vertices are stored relative to the node's origin. The pivot is wherever the point (0, 0, 0) of that mesh data falls. An exporter that receives an object with a separate pivot applies the offset into the vertices or adds an extra node.

02 // HOW TO

Move the origin and export again

  1. Import the GLB into your 3D editor and look at where the origin marker sits on each object.
  2. Snap the editor's cursor to the point that should be the pivot, such as the bottom center or a hinge.
  3. Set the object's origin to the cursor.
  4. Apply rotation and scale, so the node exports with rotation 0 and scale 1.
  5. Export the GLB and check that the model now turns around the right point.

meshfx has units and origin settings, can face a named axis and rename nodes. Set the scale using the known dimensions of your source, then inspect the output in Godot 4. Hosted meshfx runs are available in the Playground.

03 // IN CODE

Offset it in three.js or Godot instead

In three.js, add gltf.scene to a THREE.Group, set gltf.scene.position to minus the pivot point, and rotate the group. In Godot, make the imported scene a child of a Node3D, move it so the pivot point sits on the Node3D origin, and rotate the Node3D.

door-pivot.js
const pivot = new THREE.Group();
pivot.add(gltf.scene);
// move the hinge at x = 0.45 m onto the group origin
gltf.scene.position.set(-0.45, 0, 0);
scene.add(pivot);
pivot.rotation.y = Math.PI / 2; // the door swings on its hinge

05 // FAQ

GLB pivot questions

All questions →

README.FIX_PIVOT_POINT_GLB
How do I change the pivot of a GLB after loading it in three.js?

Wrap gltf.scene in a THREE.Group and offset gltf.scene.position by minus the pivot point. Rotating the group then turns the model around that point.

How do I set the pivot of a GLB in Godot?

Godot uses the node origin from the file. Fix it in your 3D editor and reimport or put the model under a Node3D and offset it.

Should I apply rotation and scale before exporting a GLB?

Yes. Applied transforms export as rotation 0 and scale 1 on the node, so the pivot behaves the same in every engine.

Does GLB keep my model pivot?

Yes, as node origins. A GLB keeps each object origin and transform, while OBJ and STL write everything into the vertex positions.

Explore meshfx outputs

Inspect compiled meshfx outputs and their reports. Hosted meshfx runs are available in the Playground.

All effects, guides and explainers →