import { worldTransformOf } from '../../NodeContext'; import type { NodeDef } from '../../NodeRegistry'; import { asEntity } from '../../values'; import { num, obj } from '../shared'; export const GetZ: NodeDef = { type: 'GetZ', label: 'Get Z', category: 'data', description: 'The z of an object, which decides what is drawn in front: local to its parent (z) and summed up (world z).', inputs: [obj('object')], outputs: [num('z'), num('worldZ', 'world z')], params: [], run: (_ctx, inputs) => { const target = asEntity(inputs.object); return { outputs: { z: target?.z ?? 0, worldZ: target ? worldTransformOf(target).z : 0 } }; }, };