@margoengine/rigging 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +4 -0
- package/README.md +1443 -2
- package/dist/anatomy-data-ansur2.d.ts +63 -0
- package/dist/anatomy-data-cdc.d.ts +16 -0
- package/dist/anatomy-data-deleva.d.ts +86 -0
- package/dist/anatomy-human.d.ts +67 -0
- package/dist/anatomy-human.js +2229 -0
- package/dist/anatomy.d.ts +638 -0
- package/dist/anatomy.js +1112 -0
- package/dist/autorig.d.ts +50 -0
- package/dist/autorig.js +663 -0
- package/dist/bar-grip.d.ts +7 -0
- package/dist/body-volumes-DTym0RVY.js +56 -0
- package/dist/body-volumes.d.ts +19 -0
- package/dist/checks.d.ts +50 -0
- package/dist/contact.d.ts +186 -0
- package/dist/contact.js +746 -0
- package/dist/correctives.d.ts +92 -0
- package/dist/correctives.js +162 -0
- package/dist/coupling.d.ts +57 -0
- package/dist/coupling.js +330 -0
- package/dist/errors-D8rc8kzg.js +7 -0
- package/dist/face.d.ts +93 -0
- package/dist/face.js +144 -0
- package/dist/hands.d.ts +209 -0
- package/dist/hands.js +510 -0
- package/dist/heat.d.ts +38 -0
- package/dist/hinged-contact.d.ts +7 -0
- package/dist/hulls.d.ts +54 -0
- package/dist/hulls.js +134 -0
- package/dist/ik.d.ts +162 -0
- package/dist/ik.js +561 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +390 -0
- package/dist/joint-limits.d.ts +44 -0
- package/dist/joint-limits.js +74 -0
- package/dist/limb-collision.d.ts +99 -0
- package/dist/loading-CZaYr1N7.js +67 -0
- package/dist/mesh-CyvLHNp0.js +142 -0
- package/dist/mesh.d.ts +47 -0
- package/dist/mtoon-data.d.ts +118 -0
- package/dist/mtoon-legacy.d.ts +17 -0
- package/dist/mtoon-shader.d.ts +4 -0
- package/dist/mtoon.d.ts +84 -0
- package/dist/mtoon.js +990 -0
- package/dist/paint.d.ts +82 -0
- package/dist/pose-tracking.d.ts +117 -0
- package/dist/pose-tracking.js +488 -0
- package/dist/retarget.d.ts +78 -0
- package/dist/retarget.js +375 -0
- package/dist/rig-BawZ5OLb.js +127 -0
- package/dist/rig.d.ts +65 -0
- package/dist/shared/gltf.d.ts +257 -0
- package/dist/shared/layers.d.ts +16 -0
- package/dist/springs.d.ts +180 -0
- package/dist/springs.js +458 -0
- package/dist/strand-springs.d.ts +46 -0
- package/dist/strand-springs.js +168 -0
- package/dist/swim.d.ts +55 -0
- package/dist/swim.js +167 -0
- package/dist/transfer.d.ts +41 -0
- package/dist/transfer.js +136 -0
- package/dist/validate.d.ts +188 -0
- package/dist/validate.js +440 -0
- package/dist/voxel-weights-48ok-Dax.js +255 -0
- package/dist/voxel-weights.d.ts +42 -0
- package/dist/voxel-weights.js +1 -0
- package/dist/voxels.d.ts +36 -0
- package/dist/vrm-constraints.d.ts +60 -0
- package/dist/vrm-constraints.js +261 -0
- package/dist/vrm-first-person.d.ts +115 -0
- package/dist/vrm-first-person.js +618 -0
- package/dist/vrm-presets-CU4V4yq6.js +47 -0
- package/dist/vrm-presets.d.ts +1 -0
- package/dist/vrm.d.ts +303 -0
- package/dist/vrm.js +574 -0
- package/dist/vrm0.d.ts +134 -0
- package/dist/vrm0.js +377 -0
- package/dist/vrma.d.ts +90 -0
- package/dist/vrma.js +315 -0
- package/dist/weight-map-D8cAONQQ.js +92 -0
- package/dist/weight-map.d.ts +58 -0
- package/package.json +189 -4
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/body-volumes.ts
|
|
2
|
+
var e = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function t(t) {
|
|
4
|
+
let n = e.get(t);
|
|
5
|
+
if (n) return n;
|
|
6
|
+
let r = t.species, i = t.stature > 0 ? t.stature : 1, a = (e) => {
|
|
7
|
+
let n = t.index.get(e);
|
|
8
|
+
return n === void 0 ? void 0 : t.joints[n].bone;
|
|
9
|
+
}, o = /* @__PURE__ */ new Map();
|
|
10
|
+
for (let e of r.volumes ?? []) {
|
|
11
|
+
let t = a(e.from), n = e.to.map(a).find((e) => e !== void 0 && e !== t);
|
|
12
|
+
t !== void 0 && n !== void 0 && o.set(e.id, {
|
|
13
|
+
near: t,
|
|
14
|
+
far: n,
|
|
15
|
+
r0: e.radius[0] * i,
|
|
16
|
+
r1: e.radius[1] * i
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return n = {
|
|
20
|
+
volumes: o,
|
|
21
|
+
pairs: (r.apart ?? []).filter(([e, t]) => {
|
|
22
|
+
let n = o.get(e), r = o.get(t);
|
|
23
|
+
return n && r && n.near !== r.near && n.near !== r.far && n.far !== r.near && n.far !== r.far;
|
|
24
|
+
})
|
|
25
|
+
}, e.set(t, n), n;
|
|
26
|
+
}
|
|
27
|
+
var n = (e, t) => [
|
|
28
|
+
e[0] - t[0],
|
|
29
|
+
e[1] - t[1],
|
|
30
|
+
e[2] - t[2]
|
|
31
|
+
], r = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
|
|
32
|
+
function i(e, t, i, a) {
|
|
33
|
+
let o = n(t, e), s = n(a, i), c = n(e, i), l = r(o, o), u = r(s, s), d = r(s, c), f = (e) => e < 0 ? 0 : e > 1 ? 1 : e, p, m;
|
|
34
|
+
if (l <= 1e-12 && u <= 1e-12) p = 0, m = 0;
|
|
35
|
+
else if (l <= 1e-12) p = 0, m = f(d / u);
|
|
36
|
+
else {
|
|
37
|
+
let e = r(o, c);
|
|
38
|
+
if (u <= 1e-12) m = 0, p = f(-e / l);
|
|
39
|
+
else {
|
|
40
|
+
let t = r(o, s), n = l * u - t * t;
|
|
41
|
+
p = n > 1e-12 ? f((t * d - e * u) / n) : 0, m = (t * p + d) / u, m < 0 ? (m = 0, p = f(-e / l)) : m > 1 && (m = 1, p = f((t - e) / l));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
let h = e[0] + o[0] * p - (i[0] + s[0] * m), g = e[1] + o[1] * p - (i[1] + s[1] * m), _ = e[2] + o[2] * p - (i[2] + s[2] * m);
|
|
45
|
+
return [
|
|
46
|
+
p,
|
|
47
|
+
m,
|
|
48
|
+
h * h + g * g + _ * _
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
function a(e, t, n, r, a, o, s) {
|
|
52
|
+
let [c, l, u] = i(e, t, r, a), d = s * (n.r0 + (n.r1 - n.r0) * c + o.r0 + (o.r1 - o.r0) * l), f = Math.sqrt(u);
|
|
53
|
+
return f < d ? d - f : 0;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { i as n, a as r, t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AnatomicalRig } from './anatomy.js';
|
|
2
|
+
/** A capsule on the rig: the bones at its two ends and its radius at each, in rig units. */
|
|
3
|
+
export interface BodyVolume {
|
|
4
|
+
readonly near: number;
|
|
5
|
+
readonly far: number;
|
|
6
|
+
readonly r0: number;
|
|
7
|
+
readonly r1: number;
|
|
8
|
+
}
|
|
9
|
+
/** The capsules of a fitted body by id, and the pairs of them that must stay apart. */
|
|
10
|
+
export interface BodyVolumes {
|
|
11
|
+
readonly volumes: Map<string, BodyVolume>;
|
|
12
|
+
readonly pairs: readonly (readonly [string, string])[];
|
|
13
|
+
}
|
|
14
|
+
/** The body's volumes and the pairs that stay apart; pairs that share an end bone meet at a joint and are left out. */
|
|
15
|
+
export declare function bodyVolumes(body: AnatomicalRig): BodyVolumes;
|
|
16
|
+
/** Closest points of segments p0-p1 and q0-q1: [s, t, squared distance] (Ericson 2005, 5.1.9). */
|
|
17
|
+
export declare function closestSegments(p0: ArrayLike<number>, p1: ArrayLike<number>, q0: ArrayLike<number>, q1: ArrayLike<number>): [number, number, number];
|
|
18
|
+
/** How far two capsules reach into each other past `shrink` of their radii, in rig units; 0 when apart. */
|
|
19
|
+
export declare function overlapDepth(a0: ArrayLike<number>, a1: ArrayLike<number>, va: BodyVolume, b0: ArrayLike<number>, b1: ArrayLike<number>, vb: BodyVolume, shrink: number): number;
|
package/dist/checks.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type RigJoint } from './rig.js';
|
|
2
|
+
import { WeightMap, type VertexInfluences } from './weight-map.js';
|
|
3
|
+
/** What a {@link SkinIssue} is about. */
|
|
4
|
+
export type SkinIssueCode = 'unweighted' | 'too-many-influences' | 'not-normalized' | 'negative-weight' | 'non-finite' | 'invalid-joint' | 'duplicate-joint' | 'degenerate-bone';
|
|
5
|
+
/** One kind of fault found by {@link checkSkin}, with up to 16 examples. */
|
|
6
|
+
export interface SkinIssue {
|
|
7
|
+
readonly code: SkinIssueCode;
|
|
8
|
+
/** How many vertices (or bones, for `degenerate-bone`) have it. */
|
|
9
|
+
readonly count: number;
|
|
10
|
+
/** The first vertices with it (at most 16). */
|
|
11
|
+
readonly vertices: readonly number[];
|
|
12
|
+
/** The bones involved (`degenerate-bone`, `invalid-joint`, `duplicate-joint`), at most 16. */
|
|
13
|
+
readonly bones: readonly number[];
|
|
14
|
+
/** The fault and its fix, in one sentence. */
|
|
15
|
+
readonly message: string;
|
|
16
|
+
}
|
|
17
|
+
/** {@link checkSkin}'s result. */
|
|
18
|
+
export interface SkinReport {
|
|
19
|
+
/** True when there are no issues. */
|
|
20
|
+
readonly ok: boolean;
|
|
21
|
+
readonly vertexCount: number;
|
|
22
|
+
readonly issues: readonly SkinIssue[];
|
|
23
|
+
}
|
|
24
|
+
/** Input to {@link checkSkin}: weights, and optionally the skeleton they bind to. */
|
|
25
|
+
export interface SkinCheckInput {
|
|
26
|
+
/** Per-vertex influences (JOINTS_0 / WEIGHTS_0, or wider) or a dense {@link WeightMap}. */
|
|
27
|
+
readonly weights: VertexInfluences | WeightMap;
|
|
28
|
+
/** Joints in the skin (default the WeightMap's bone count, or one more than the largest index). */
|
|
29
|
+
readonly jointCount?: number;
|
|
30
|
+
/** Most nonzero weights a vertex may have (default 4). */
|
|
31
|
+
readonly maxInfluences?: number;
|
|
32
|
+
/** Largest |sum - 1| that counts as normalised (default 1e-3). */
|
|
33
|
+
readonly tolerance?: number;
|
|
34
|
+
/** Rest skeleton: bones whose joint sits on its parent's position (zero length) are reported. */
|
|
35
|
+
readonly joints?: readonly RigJoint[];
|
|
36
|
+
/** Inverse bind matrices, 16 per joint: non-finite or non-invertible ones (a zero scale) are reported. */
|
|
37
|
+
readonly inverseBindMatrices?: ArrayLike<number>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Checks skin weights before export: unweighted vertices, more than `maxInfluences` (4) influences, weights that do
|
|
41
|
+
* not sum to 1, negative or non-finite weights, joint indices outside the skin (in any slot, weighted or not), one
|
|
42
|
+
* joint in two weighted slots of a vertex, and degenerate bones (a joint at its
|
|
43
|
+
* parent's position, or a non-invertible inverse bind matrix). Returns every kind of fault found; nothing is changed.
|
|
44
|
+
*/
|
|
45
|
+
export declare function checkSkin(input: SkinCheckInput): SkinReport;
|
|
46
|
+
/**
|
|
47
|
+
* {@link checkSkin}, throwing when it finds anything: call it right before export.
|
|
48
|
+
* @throws RangeError naming every fault found and its fix.
|
|
49
|
+
*/
|
|
50
|
+
export declare function assertSkin(input: SkinCheckInput): void;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// @ts-ignore optional peer: its types apply when it is installed
|
|
2
|
+
import type { Animator } from '@margoengine/animator';
|
|
3
|
+
// @ts-ignore optional peer: its types apply when it is installed
|
|
4
|
+
import { type CCDJointLimit } from '@margoengine/animator/ccd';
|
|
5
|
+
// @ts-ignore optional peer: its types apply when it is installed
|
|
6
|
+
import { type Anatomy } from '@margoengine/animator/ik';
|
|
7
|
+
import type { Vec3 } from '@margoengine/math';
|
|
8
|
+
import { type HandRig, type HandSide } from './hands.js';
|
|
9
|
+
import type { IKPose } from './ik.js';
|
|
10
|
+
import type { HumanoidBone, SkeletonPreset } from './retarget.js';
|
|
11
|
+
export { LimbCollisionRig } from './limb-collision.js';
|
|
12
|
+
export type { BodyCollisionVolume, CollisionLandmark, LimbCollisionLink, LimbCollisionSample, LimbDirectionLimit, LimbSweepOptions, LimbSweepResult, } from './limb-collision.js';
|
|
13
|
+
type Quaternion = readonly [number, number, number, number];
|
|
14
|
+
/** Anatomical limit at one joint, calibrated in the same local axes as the pose. */
|
|
15
|
+
export interface ContactJointLimit {
|
|
16
|
+
/** Bone index in the skeleton. The bone must belong to the contact chain. */
|
|
17
|
+
readonly joint: number;
|
|
18
|
+
/** The joint's local neutral rotation, [x, y, z, w], from which the limit is measured. */
|
|
19
|
+
readonly neutral: Quaternion;
|
|
20
|
+
/** A hinge, swing-twist cone or per-axis range, in radians, around the neutral rotation. */
|
|
21
|
+
readonly limit: CCDJointLimit;
|
|
22
|
+
}
|
|
23
|
+
/** A palm, fingertip, sole or hoof landmark pinned to a point and an orientation in skeleton space. */
|
|
24
|
+
export interface ContactIKOptions {
|
|
25
|
+
/** Contiguous joint indices from the first joint through the wrist, ankle or other end joint. */
|
|
26
|
+
readonly joints: readonly number[];
|
|
27
|
+
/** Point on the surface in skeleton space. */
|
|
28
|
+
readonly point: Vec3;
|
|
29
|
+
/** Target end-joint rotation in skeleton space, [x, y, z, w]. */
|
|
30
|
+
readonly rotation: Quaternion;
|
|
31
|
+
/** Landmark in the end joint's local coordinates, before the end joint's scale. */
|
|
32
|
+
readonly anchor: Vec3;
|
|
33
|
+
/** Blend toward the contact, default 1. Zero preserves the input pose exactly. */
|
|
34
|
+
readonly weight?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Anatomical limits for the joints to constrain. Default: the ranges of the pose's fitted body (`body`, `pose.body`
|
|
37
|
+
* or `setAnatomy(pose, body)`) for every joint of the chain, each measured from its anatomical zero. A list given
|
|
38
|
+
* here is used as it is, and joints not in it are free.
|
|
39
|
+
*/
|
|
40
|
+
readonly limits?: readonly ContactJointLimit[];
|
|
41
|
+
/**
|
|
42
|
+
* The fitted body whose joint ranges the chain takes when `limits` is not given. Default: the pose's body. Null
|
|
43
|
+
* leaves the body out, so with no `limits` every joint is free.
|
|
44
|
+
*/
|
|
45
|
+
readonly body?: Anatomy | null;
|
|
46
|
+
/** Point on the desired elbow or knee bend side in skeleton space. */
|
|
47
|
+
readonly pole?: Vec3 | null;
|
|
48
|
+
/** Maximum CCD sweeps, from 1 to 1,024. Default 64. */
|
|
49
|
+
readonly iterations?: number;
|
|
50
|
+
/** Maximum positional error to accept for contact, in scene units. Default 0.0001. */
|
|
51
|
+
readonly tolerance?: number;
|
|
52
|
+
/** Maximum angular error to accept for contact, in radians. Default 0.02. */
|
|
53
|
+
readonly angleTolerance?: number;
|
|
54
|
+
/** Signed clearance of the posed chain. Packed skeleton-space XYZ points and XYZW rotations are valid during the call. */
|
|
55
|
+
readonly clearance?: (positions: ArrayLike<number>, rotations: ArrayLike<number>) => number;
|
|
56
|
+
/** Follow the explicit pole with a single analytical bend. Requires a penultimate hinge and at least three joints. */
|
|
57
|
+
readonly reach?: 'hinged';
|
|
58
|
+
}
|
|
59
|
+
/** What the posed landmark achieved. Use `locked` to start a grasp or foot plant. */
|
|
60
|
+
export interface ContactIKResult {
|
|
61
|
+
/** True when the posed landmark is within the position and orientation tolerances of the requested contact. */
|
|
62
|
+
readonly locked: boolean;
|
|
63
|
+
/** Gap between the posed landmark and the requested contact point. */
|
|
64
|
+
readonly distance: number;
|
|
65
|
+
/** Shortest angular distance from the posed end joint to the requested rotation, in radians. */
|
|
66
|
+
readonly angle: number;
|
|
67
|
+
/** The measured point on the final pose, in skeleton space. */
|
|
68
|
+
readonly point: Vec3;
|
|
69
|
+
/** True when clearance prevented the solve from writing the arm. Present when a clearance callback is supplied. */
|
|
70
|
+
readonly blocked?: boolean;
|
|
71
|
+
/** Signed gap of the returned pose, in skeleton units. Present when a clearance callback is supplied. */
|
|
72
|
+
readonly clearance?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Solves at a physical point on the limb. The CCD solver applies joint limits throughout the solve, so reaching for
|
|
76
|
+
* the contact cannot force a wrist to twist or an elbow to bend backwards past its calibrated range. Each segment
|
|
77
|
+
* keeps its length. Contact is measured on the resulting pose, including when the point or orientation is unreachable.
|
|
78
|
+
* @throws RangeError for invalid chain data, scales, limits, contact weights, landmarks, rotations or tolerances.
|
|
79
|
+
* @throws TypeError for a malformed pose or chain.
|
|
80
|
+
*/
|
|
81
|
+
export declare function solveContactIK(pose: IKPose, options: ContactIKOptions): ContactIKResult;
|
|
82
|
+
/** Per-character calibration for reaching, planting and gripping with one hand. */
|
|
83
|
+
export interface PalmContactCalibration {
|
|
84
|
+
/** The authored side of the skeleton. */
|
|
85
|
+
readonly side: HandSide;
|
|
86
|
+
/** Contiguous arm chain ending at the mapped wrist. Include twist or shoulder helpers that can move. */
|
|
87
|
+
readonly joints: readonly number[];
|
|
88
|
+
/** Override the detected skeleton naming, or provide a map for a custom skeleton. */
|
|
89
|
+
readonly preset?: SkeletonPreset;
|
|
90
|
+
/** Names to indices for custom rigs, including the wrist and measured finger bones. */
|
|
91
|
+
readonly bones?: ReadonlyMap<HumanoidBone, number>;
|
|
92
|
+
/** Calibrated arm limits. An explicit wrist entry overrides the inferred wrist limit. */
|
|
93
|
+
readonly limits?: readonly ContactJointLimit[];
|
|
94
|
+
/** Optional elbow hinge and forearm roll calibrated relative to the imported rest pose. */
|
|
95
|
+
readonly elbow?: PalmElbowCalibration;
|
|
96
|
+
/** Forearm-to-hand angle bounds. Defaults to calibrated flexion, extension and side deviation. */
|
|
97
|
+
readonly wrist?: PalmWristRanges | false;
|
|
98
|
+
/** Exact skin contact point in wrist-local coordinates. Default uses the measured palm centre and pad depth. */
|
|
99
|
+
readonly anchor?: Vec3;
|
|
100
|
+
/** Maximum palm gap in skeleton units for grip engagement. Default 0.003. */
|
|
101
|
+
readonly tolerance?: number;
|
|
102
|
+
/** Maximum palm angle error in radians for grip engagement. Default 0.0873 (five degrees). */
|
|
103
|
+
readonly angleTolerance?: number;
|
|
104
|
+
}
|
|
105
|
+
/** Functional wrist angles measured between the forearm and the palm, independent of imported bone axes. */
|
|
106
|
+
export interface PalmWristRanges {
|
|
107
|
+
/** Palm-side bend from neutral, radians. Default 1.12 (64 degrees). */
|
|
108
|
+
readonly flexion?: number;
|
|
109
|
+
/** Back-of-hand bend from neutral, radians. Default 1.0 (57 degrees). */
|
|
110
|
+
readonly extension?: number;
|
|
111
|
+
/** Absolute sideways bend, radians. Default 0.46 (26 degrees). */
|
|
112
|
+
readonly deviation?: number;
|
|
113
|
+
}
|
|
114
|
+
/** Calibrates the positive side of an elbow joint's flexion in skeleton space at rest. */
|
|
115
|
+
export interface PalmElbowCalibration {
|
|
116
|
+
/** An intermediate joint of the arm chain. */
|
|
117
|
+
readonly joint: number;
|
|
118
|
+
/** Direction in which the forearm bends in flexion, relative to the bind pose. */
|
|
119
|
+
readonly flexDirection: Vec3;
|
|
120
|
+
/** Minimum angle in radians from the bind pose. Default −0.035. */
|
|
121
|
+
readonly min?: number;
|
|
122
|
+
/** Maximum angle in radians from the bind pose. Default 2.55. */
|
|
123
|
+
readonly max?: number;
|
|
124
|
+
/** Signed forearm roll in radians, default [−1.25, 1.25]. Pass false when a separate calibrated twist joint drives roll. */
|
|
125
|
+
readonly roll?: readonly [number, number] | false;
|
|
126
|
+
}
|
|
127
|
+
/** A palm target with geometric orientation and a cylindrical grip. Positions and directions use skeleton space. */
|
|
128
|
+
export interface PalmContactTarget {
|
|
129
|
+
/** Actual surface point where the palm pad lands. */
|
|
130
|
+
readonly point: Vec3;
|
|
131
|
+
/** Outward normal of the surface, pointing toward the approaching hand. */
|
|
132
|
+
readonly normal: Vec3;
|
|
133
|
+
/** Direction from wrist to fingers along the surface. Projected onto the normal plane. */
|
|
134
|
+
readonly towardsFingers: Vec3;
|
|
135
|
+
/** Diameter of the grip in skeleton units. */
|
|
136
|
+
readonly diameter: number;
|
|
137
|
+
/** Requested finger closure 0–1, default 1. Contact confidence may reduce this. */
|
|
138
|
+
readonly close?: number;
|
|
139
|
+
/** Reach weight 0–1, default 1. Zero leaves the current pose intact. */
|
|
140
|
+
readonly weight?: number;
|
|
141
|
+
/** A point toward which the elbow bends, in skeleton space. */
|
|
142
|
+
readonly elbowPole?: Vec3;
|
|
143
|
+
/** Whole-arm clearance check for this sample. See the packed positions in {@link ContactIKOptions.clearance}. */
|
|
144
|
+
readonly clearance?: ContactIKOptions['clearance'];
|
|
145
|
+
/** Keep the elbow in the supplied pole's bend plane. Requires elbow calibration and an explicit elbow pole. */
|
|
146
|
+
readonly reach?: ContactIKOptions['reach'];
|
|
147
|
+
}
|
|
148
|
+
/** Measured palm registration and the applied finger closure for one sample. */
|
|
149
|
+
export interface PalmContactResult extends ContactIKResult {
|
|
150
|
+
/** Final weight of the cylindrical finger pose, from zero to one. */
|
|
151
|
+
readonly gripWeight: number;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Maps a real surface frame to a measured wrist and finger rig. The arm solver respects its authored joint limits.
|
|
155
|
+
* Finger closure is computed from the achieved palm pose and eases to zero at the contact boundary. The solver is
|
|
156
|
+
* independent of playback history, so contact can be baked, played forward or evaluated out of order.
|
|
157
|
+
*/
|
|
158
|
+
export declare class PalmContactRig {
|
|
159
|
+
private readonly rig;
|
|
160
|
+
private readonly hand;
|
|
161
|
+
private readonly inversePalm;
|
|
162
|
+
private readonly arm;
|
|
163
|
+
private readonly limits;
|
|
164
|
+
private readonly tolerance;
|
|
165
|
+
private readonly angleTolerance;
|
|
166
|
+
private readonly open;
|
|
167
|
+
private readonly gripForward;
|
|
168
|
+
private readonly gripNormal;
|
|
169
|
+
private readonly gripAnchor;
|
|
170
|
+
private readonly wrist;
|
|
171
|
+
private gripPose?;
|
|
172
|
+
/** Calibrated surface point in the wrist's local coordinates. */
|
|
173
|
+
readonly anchor: Vec3;
|
|
174
|
+
/** Arm and finger joints which this solve can rotate. */
|
|
175
|
+
readonly joints: readonly number[];
|
|
176
|
+
/** Prepares one calibrated contact rig from its rest skeleton. */
|
|
177
|
+
constructor(rig: HandRig, calibration: PalmContactCalibration);
|
|
178
|
+
/** Rotates the arm and fingers for one surface sample, leaving all other local transforms intact. */
|
|
179
|
+
solve(local: Float64Array, target: PalmContactTarget): PalmContactResult;
|
|
180
|
+
private wristGap;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Runs calibrated palm contact after the Animator's pose and other solvers. Supply the current target in model
|
|
184
|
+
* space or return undefined to release the procedural layer. Returns a function that removes the solver.
|
|
185
|
+
*/
|
|
186
|
+
export declare function addPalmContact(animator: Animator, calibration: PalmContactCalibration, target: () => PalmContactTarget | undefined, onSolve?: (result: PalmContactResult) => void): () => void;
|