Model loading · function

orientNodes

Turn an asset's hierarchy by the same rotation orientMeshes turns its geometry by.

Explained in Importing models.

function orientNodes(nodes: readonly DrftNode[], assetUp: UpAxis): DrftNode[]
import { orientNodes } from '@driftengine/assets';

Parameters

ParameterTypeDescription
nodesreadonly DrftNode[]
assetUpUpAxis

In depth

Without this, --up silently desynchronises the two. The meshes rotate and the graph does not, so every node then claims a part is somewhere it no longer is — and nothing downstream can detect it, because both halves are individually well formed. That is the worst shape a bug can take in a bake, so the two turns happen together or the hierarchy is wrong.

Only roots are turned, and that is not an optimisation: a child's transform is relative to its parent, so rotating the parent already carries every descendant with it. Turning a child too would apply the rotation twice.