Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

15.8 KB
Raw Blame
// GENERATED by scripts/build-canonical-rest.mjs from public/avatars/cz.glb.
// Do not edit by hand: re-run the generator, which writes this file and its
// twin at src/animation-canonical-rest.js from the same measurement pass.
//
// The reference skeleton every three.ws motion is authored against: the
// Avaturn rig the platform's ~3,000 clip library was baked on. Four tables
// describe it completely enough to run forward and inverse kinematics in plain
// JS with no renderer attached, which is what lets this package synthesize
// motion in a Node script, a Cloud Run handler, or a browser tab from the same
// code path.
//
//   CANONICAL_REST          local (bind) rotation per bone, [x,y,z,w]
//   CANONICAL_REST_WORLD    the same rotations composed to model space
//   CANONICAL_REST_POSITION model-space bind position per bone, in metres
//   CANONICAL_PARENT        nearest canonical ancestor, null at the root
//
// tests/motion-skeleton-parity.test.js fails if this copy and the site copy
// ever disagree, so the published package can never drift from the rig the
// platform actually retargets onto.

export const CANONICAL_REST = Object.freeze({
	Head: [-0.11706881878098431, 9.438845082943482e-9, 3.72654613409334e-8, 0.993123804804428],
	Hips: [0.0010741148761599644, 6.537898515070053e-8, 7.022659074474357e-11, 0.9999994231384476],
	LeftArm: [-0.003089573263103852, 0.08018148459223169, -0.025041829737156785, 0.9964608827384491],
	LeftFoot: [0.5523737034239063, 0.0002518875693487157, 0.0036538113016644914, 0.8335885543726441],
	LeftForeArm: [-2.6826767953574183e-7, 1.2816740072681333e-7, 0.012369379808617674, 0.9999234962951223],
	LeftHand: [-0.0012910117424963744, 0.002537815819541244, 0.010116448936771993, 0.9999447735952517],
	LeftHandIndex1: [0.028803290204768833, 0.011362422123976328, 0.055965724298468224, 0.9979524555518633],
	LeftHandIndex2: [-0.005195237841915152, 0.014315447122751807, 0.00021581682553071412, 0.9998840087229335],
	LeftHandIndex3: [-0.0013151015878908295, -0.016941197343945148, -0.006458334440614796, 0.9998347644768737],
	LeftHandMiddle1: [0.027532617383276645, -0.031607746403852485, 0.016931179482824785, 0.9989775976007271],
	LeftHandMiddle2: [-0.001267981765488788, 0.0010468621884392817, -0.004466175725402764, 0.9999886747239598],
	LeftHandMiddle3: [-0.0015803533040544947, 0.0018352886876119797, 0.0038040706030556736, 0.9999898315711762],
	LeftHandPinky1: [0.009345046842530319, -0.07377447953394943, -0.04207784173776388, 0.9963430390695086],
	LeftHandPinky2: [-0.0019002180814112143, 0.0002770864318134059, 0.0004968185265866393, 0.9999980327809131],
	LeftHandPinky3: [-0.0014157518824255099, -0.005595319155644295, -0.004606740515194791, 0.9999727326242506],
	LeftHandRing1: [0.018207541076892743, -0.03436008716699126, -0.036855349348364555, 0.9985637451229231],
	LeftHandRing2: [-0.0006571286469542868, 0.015477225242721515, 0.01003471962236163, 0.9998296495318929],
	LeftHandRing3: [0.001815607007583071, -0.003099595768579846, 0.0072046170631637615, 0.999967594260012],
	LeftHandThumb1: [0.1900227602341495, -0.058826116539083484, 0.3478783626049766, 0.9161940209594684],
	LeftHandThumb2: [0.01801363066187901, -0.020968588375318502, -0.22063576333056306, 0.9749644544258214],
	LeftHandThumb3: [-0.014498565873099356, 0.03466160908487025, 0.011599642488048602, 0.9992266072970502],
	LeftLeg: [-0.022987686472704008, -0.0006608912898930547, 0.00007960712093047862, 0.9997355266049326],
	LeftShoulder: [0.5181706903502131, 0.5134387363832796, -0.48299308003518876, 0.4843526489955184],
	LeftToeBase: [0.23652217735689587, 0.0006644108661216591, -0.002051152932444189, 0.9716236982227819],
	LeftUpLeg: [-0.00004952055077835167, 0.0032567616062252223, 0.9999946186652781, -0.00039203576089550014],
	Neck: [0.2225107795455935, -2.3352293238692193e-7, -1.9647139012020554e-8, 0.974930229804142],
	RightArm: [-0.003089570938390283, -0.08018164882954634, 0.025041835809991725, 0.9964608693782484],
	RightFoot: [0.5523737112340288, -0.00025188760500252676, -0.0036538107149212758, 0.8335885491999105],
	RightForeArm: [-2.706717415294191e-7, 6.0675494372234465e-9, -0.012369382961452784, 0.9999234962561284],
	RightHand: [-0.0012910114923260908, -0.002537815924782367, -0.010116450486313036, 0.9999447735796301],
	RightHandIndex1: [0.028803284769926347, -0.01136242475457741, -0.05596571258489258, 0.9979524563349205],
	RightHandIndex2: [-0.005195229421057241, -0.014315442233259087, -0.00021582506177354608, 0.9998840088349297],
	RightHandIndex3: [-0.0013151045827228072, 0.016941319655899355, 0.006458327385746035, 0.9998347624459482],
	RightHandMiddle1: [0.027532662650122483, 0.03160778647114273, -0.01693120529165708, 0.9989775946478099],
	RightHandMiddle2: [-0.0012680273836480952, -0.0010469047250576836, 0.004466199390698661, 0.9999886745158897],
	RightHandMiddle3: [-0.0015803562094451136, -0.001835288773706009, -0.003804068167924464, 0.9999898315756854],
	RightHandPinky1: [0.009345030274151258, 0.07377446325595405, 0.04207784564870347, 0.9963430402658229],
	RightHandPinky2: [-0.0019002008217559384, -0.0002769620503994165, -0.0004968229018870381, 0.9999980328459891],
	RightHandPinky3: [-0.0014157497333212687, 0.0055951881780210025, 0.004606743315319843, 0.9999727333471813],
	RightHandRing1: [0.01820754441109714, 0.03436008722907556, 0.03685535429214536, 0.9985637448787448],
	RightHandRing2: [-0.0006571335802527884, -0.015477230302375519, -0.010034723368684675, 0.999829649412505],
	RightHandRing3: [0.0018156069598940002, 0.003099598646436032, -0.007204626788931167, 0.9999675941811231],
	RightHandThumb1: [0.19002276085311107, 0.05882618704962336, -0.3478783387552461, 0.9161940229953188],
	RightHandThumb2: [0.018013663274561078, 0.020968550782212388, 0.22063584956274163, 0.9749644350943654],
	RightHandThumb3: [-0.014498582331377526, -0.03466161961137741, -0.011599713293476643, 0.9992266058762234],
	RightLeg: [-0.022987685898989207, 0.0006609402907891899, -0.00007960698692017099, 0.9997355265857409],
	RightShoulder: [0.5181706006117709, -0.5134387953473804, 0.4829931766210871, 0.4843525890882128],
	RightToeBase: [0.23652222014073046, -0.0006644109035597298, 0.0020511526077556528, 0.9716236878087238],
	RightUpLeg: [0.000049438593286575395, 0.003256759408127677, 0.9999946186765544, 0.0003920356017771739],
	Spine: [-0.018332562694809717, -1.4544833124647894e-7, 2.6976261645093277e-10, 0.9998319444511763],
	Spine1: [-0.03815628571181615, 2.0010687323521798e-8, 5.34807122500512e-9, 0.9992717837809081],
	Spine2: [-0.056998031890724846, 1.3546308636882866e-7, -8.861325315468363e-10, 0.9983742907149431],
});

export const CANONICAL_REST_WORLD = Object.freeze({
	Head: [-0.005402766806732544, -1.5440620455356296e-7, 8.34223242528311e-10, 0.9999854049488961],
	Hips: [0.0010741148761599644, 6.537898515070053e-8, 7.022659074474357e-11, 0.9999994231384476],
	LeftArm: [0.4889318420664182, 0.5108287295941205, -0.5108290884863605, 0.48893078190839623],
	LeftFoot: [-0.00007112359875637768, 0.5349085331963127, 0.8448985998862468, -0.004383145577274271],
	LeftForeArm: [0.49521300584988104, 0.5047420653526237, -0.5047420379230214, 0.4952120815979495],
	LeftHand: [0.5009334720626235, 0.5016127781291206, -0.4977959877649929, 0.49964931327533474],
	LeftHandIndex1: [0.5480286232738694, 0.46388966319384123, -0.47756977349452234, 0.506357703809076],
	LeftHandIndex2: [0.5522711480640051, 0.4734474077351049, -0.46714980714345783, 0.5026083894226862],
	LeftHandIndex3: [0.5405471533897316, 0.46903549072233974, -0.4790521335412708, 0.5082553896043159],
	LeftHandMiddle1: [0.5069366564823887, 0.46312011824587895, -0.5184714785961669, 0.5096295836965867],
	LeftHandMiddle2: [0.5047591066222094, 0.46656986579426646, -0.5196237813564338, 0.5074661907650336],
	LeftHandMiddle3: [0.5066805225023663, 0.46639751835165716, -0.5160243364733309, 0.509379123507728],
	LeftHandPinky1: [0.4459394011607033, 0.4793433042957962, -0.5586434331057456, 0.5092009093395086],
	LeftHandPinky2: [0.4453638702749085, 0.48032344738196137, -0.5573549331147079, 0.5101920146245817],
	LeftHandPinky3: [0.4392981168466072, 0.4802964151504903, -0.5615019919023976, 0.5109286011992389],
	LeftHandRing1: [0.47371996160924823, 0.4931227775910745, -0.5418410288696247, 0.4886999364902444],
	LeftHandRing2: [0.48665266892609377, 0.49620490515614146, -0.5291888435031511, 0.48673303168821197],
	LeftHandRing3: [0.48945530931580683, 0.4902132045285772, -0.5280743092981476, 0.4911843263440915],
	LeftHandThumb1: [0.6991138207882592, 0.16132571576360077, -0.40704633814367386, 0.5652673372230799],
	LeftHandThumb2: [0.64766423234777, 0.2923511094450446, -0.5391393932239583, 0.4520957758831027],
	LeftHandThumb3: [0.6626872004096495, 0.3080994487427915, -0.5067905211225114, 0.45725679518685386],
	LeftLeg: [0.0006202111480182034, -0.020805293540463354, 0.9997832430476497, -0.00047118992773536965],
	LeftShoulder: [0.4605450937998788, 0.4559956590278878, -0.537559006794696, 0.5394409087622226],
	LeftToeBase: [-0.002764355526654178, 0.7195640056310856, 0.6944147145329627, -0.0028643286082629046],
	LeftUpLeg: [-0.00004987623525000119, 0.0021826506059020026, 0.9999975399461294, -0.00039198262713485737],
	Neck: [0.11170149382802401, -1.628868597421303e-7, -1.8309282630496044e-8, 0.9937418056399563],
	RightArm: [0.48893190585215524, -0.510828798312402, 0.5108290283825504, 0.48893071200502375],
	RightFoot: [0.00007112360405196955, 0.5349085398019146, 0.844898595705669, 0.004383145306035045],
	RightForeArm: [0.4952130023257164, -0.5047420673116668, 0.5047420415306929, 0.49521208229448166],
	RightHand: [0.5009334695181179, -0.5016127792807403, 0.49779599067075153, 0.49964931459617906],
	RightHandIndex1: [0.5480286139806538, -0.4638896746971551, 0.47756977858103167, 0.5063577013132781],
	RightHandIndex2: [0.5522711446711094, -0.4734474082706649, 0.4671498147721218, 0.5026083883587248],
	RightHandIndex3: [0.5405470934413514, -0.4690354263302402, 0.47905220274050364, 0.5082554503330304],
	RightHandMiddle1: [0.5069366680435416, -0.4631200623546733, 0.5184715098400317, 0.5096295939664325],
	RightHandMiddle2: [0.5047591061928465, -0.46656986723577604, 0.5196237819671778, 0.5074661920185282],
	RightHandMiddle3: [0.5066805195140975, -0.4663975225827095, 0.5160243369168757, 0.5093791249234989],
	RightHandPinky1: [0.44593939683725603, -0.4793433241517071, 0.5586434219640141, 0.5092009094272859],
	RightHandPinky2: [0.4453638073881448, -0.4803233923217868, 0.5573549834847424, 0.5101920690951159],
	RightHandPinky3: [0.4392981269307416, -0.4802964267888911, 0.5615019867791732, 0.5109285899785551],
	RightHandRing1: [0.473719957983008, -0.49312277921221886, 0.541841035805614, 0.4886999335659278],
	RightHandRing2: [0.48665266754747677, -0.4962049100848307, 0.5291888437972645, 0.4867330306200585],
	RightHandRing3: [0.4894553112113337, -0.49021320332208906, 0.5280743062058759, 0.4911843318554558],
	RightHandThumb1: [0.6991137732035737, -0.16132569450370315, 0.40704638897707807, 0.5652673641991798],
	RightHandThumb2: [0.6476641963757893, -0.2923511418798965, 0.5391394672107036, 0.45209571648691005],
	RightHandThumb3: [0.6626871862817486, -0.3080994479425299, 0.5067905521115058, 0.4572567801626834],
	RightLeg: [-0.0006202113471683521, -0.020805295090456907, 0.9997832430151556, 0.00047119017271936915],
	RightShoulder: [0.46054507521936333, -0.45599564278848104, 0.5375590232993736, 0.5394409245169026],
	RightToeBase: [0.0027643555231566678, 0.7195640416379069, 0.6944146772223956, 0.0028643286020973192],
	RightUpLeg: [0.000049925034443819034, 0.002182648459062353, 0.9999975399486299, 0.00039198198974856475],
	Spine: [-0.017258617754264162, -8.00818266828763e-8, 1.3823133775055108e-9, 0.9998510589648868],
	Spine1: [-0.055396652424023016, -5.997624651397324e-8, 3.32759956947242e-9, 0.9984644264570511],
	Spine2: [-0.11221710079276989, 7.513757486198981e-8, -8.485311473269302e-9, 0.9936837134066652],
});

// Positions and parentage. Together with the rotations above they close the
// skeleton: every bone knows where it starts, which way it points, and who
// carries it.

export const CANONICAL_REST_POSITION = Object.freeze({
	Head: [0, 1.644459, -0.02811],
	Hips: [0, 0.984089, 0.005022],
	LeftArm: [0.204124, 1.50826, -0.034115],
	LeftFoot: [0.095793, 0.088025, -0.010018],
	LeftForeArm: [0.458234, 1.508259, -0.045252],
	LeftHand: [0.725837, 1.508259, -0.050352],
	LeftHandIndex1: [0.815413, 1.499602, -0.024435],
	LeftHandIndex2: [0.847794, 1.497747, -0.020782],
	LeftHandIndex3: [0.872293, 1.496601, -0.017998],
	LeftHandMiddle1: [0.820067, 1.500491, -0.048839],
	LeftHandMiddle2: [0.854745, 1.498698, -0.047572],
	LeftHandMiddle3: [0.881683, 1.49736, -0.046832],
	LeftHandPinky1: [0.810112, 1.495569, -0.08743],
	LeftHandPinky2: [0.8359, 1.495002, -0.089537],
	LeftHandPinky3: [0.856018, 1.494638, -0.091171],
	LeftHandRing1: [0.81666, 1.499944, -0.069059],
	LeftHandRing2: [0.850313, 1.498728, -0.071468],
	LeftHandRing3: [0.87354, 1.497943, -0.072665],
	LeftHandThumb1: [0.761831, 1.487283, -0.024616],
	LeftHandThumb2: [0.783931, 1.477329, -0.003377],
	LeftHandThumb3: [0.806009, 1.466616, 0.003515],
	LeftLeg: [0.09541, 0.505427, 0.007362],
	LeftShoulder: [0.056656, 1.508576, -0.035092],
	LeftToeBase: [0.096919, 0.022281, 0.128921],
	LeftUpLeg: [0.095072, 0.936186, 0.005482],
	Neck: [0, 1.516499, -0.057245],
	RightArm: [-0.204124, 1.50826, -0.034115],
	RightFoot: [-0.095793, 0.088025, -0.010018],
	RightForeArm: [-0.458234, 1.508259, -0.045252],
	RightHand: [-0.725837, 1.508259, -0.050352],
	RightHandIndex1: [-0.815413, 1.499602, -0.024435],
	RightHandIndex2: [-0.847794, 1.497747, -0.020783],
	RightHandIndex3: [-0.872293, 1.496601, -0.017998],
	RightHandMiddle1: [-0.820067, 1.500491, -0.048839],
	RightHandMiddle2: [-0.854745, 1.498698, -0.047572],
	RightHandMiddle3: [-0.881683, 1.49736, -0.046832],
	RightHandPinky1: [-0.810112, 1.495569, -0.08743],
	RightHandPinky2: [-0.8359, 1.495002, -0.089537],
	RightHandPinky3: [-0.856018, 1.494638, -0.091171],
	RightHandRing1: [-0.81666, 1.499944, -0.069059],
	RightHandRing2: [-0.850313, 1.498729, -0.071468],
	RightHandRing3: [-0.87354, 1.497943, -0.072665],
	RightHandThumb1: [-0.761831, 1.487283, -0.024615],
	RightHandThumb2: [-0.783931, 1.477329, -0.003377],
	RightHandThumb3: [-0.806009, 1.466616, 0.003515],
	RightLeg: [-0.09541, 0.505427, 0.007362],
	RightShoulder: [-0.056656, 1.508576, -0.035092],
	RightToeBase: [-0.096919, 0.022281, 0.128921],
	RightUpLeg: [-0.095072, 0.936186, 0.005482],
	Spine: [0, 1.077013, 0.005222],
	Spine1: [0, 1.184494, 0.00151],
	Spine2: [0, 1.330917, -0.014788],
});

export const CANONICAL_PARENT = Object.freeze({
	Head: 'Neck',
	Hips: null,
	LeftArm: 'LeftShoulder',
	LeftFoot: 'LeftLeg',
	LeftForeArm: 'LeftArm',
	LeftHand: 'LeftForeArm',
	LeftHandIndex1: 'LeftHand',
	LeftHandIndex2: 'LeftHandIndex1',
	LeftHandIndex3: 'LeftHandIndex2',
	LeftHandMiddle1: 'LeftHand',
	LeftHandMiddle2: 'LeftHandMiddle1',
	LeftHandMiddle3: 'LeftHandMiddle2',
	LeftHandPinky1: 'LeftHand',
	LeftHandPinky2: 'LeftHandPinky1',
	LeftHandPinky3: 'LeftHandPinky2',
	LeftHandRing1: 'LeftHand',
	LeftHandRing2: 'LeftHandRing1',
	LeftHandRing3: 'LeftHandRing2',
	LeftHandThumb1: 'LeftHand',
	LeftHandThumb2: 'LeftHandThumb1',
	LeftHandThumb3: 'LeftHandThumb2',
	LeftLeg: 'LeftUpLeg',
	LeftShoulder: 'Spine2',
	LeftToeBase: 'LeftFoot',
	LeftUpLeg: 'Hips',
	Neck: 'Spine2',
	RightArm: 'RightShoulder',
	RightFoot: 'RightLeg',
	RightForeArm: 'RightArm',
	RightHand: 'RightForeArm',
	RightHandIndex1: 'RightHand',
	RightHandIndex2: 'RightHandIndex1',
	RightHandIndex3: 'RightHandIndex2',
	RightHandMiddle1: 'RightHand',
	RightHandMiddle2: 'RightHandMiddle1',
	RightHandMiddle3: 'RightHandMiddle2',
	RightHandPinky1: 'RightHand',
	RightHandPinky2: 'RightHandPinky1',
	RightHandPinky3: 'RightHandPinky2',
	RightHandRing1: 'RightHand',
	RightHandRing2: 'RightHandRing1',
	RightHandRing3: 'RightHandRing2',
	RightHandThumb1: 'RightHand',
	RightHandThumb2: 'RightHandThumb1',
	RightHandThumb3: 'RightHandThumb2',
	RightLeg: 'RightUpLeg',
	RightShoulder: 'Spine2',
	RightToeBase: 'RightFoot',
	RightUpLeg: 'Hips',
	Spine: 'Hips',
	Spine1: 'Spine',
	Spine2: 'Spine1',
});