feat: add child motion picture book stage tooling
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-10 23:10:24 +08:00
parent 85ed8ca90c
commit 5cc8293380
8 changed files with 609 additions and 149 deletions

View File

@@ -78,4 +78,47 @@ describe('parseMocapPacket', () => {
expect.objectContaining({x: 0.9, y: 0.8, source: 'direct'}),
);
});
test('解析 mocap frame 的身体中心和左右手来源', () => {
const command = parseMocapPacket({
schema_version: '1.0',
stream: { type: 'mocap.frame' },
general: {
body: {
center_norm: [0.34, 0.58],
},
},
actions: [{ gesture: 'wave-left-hand' }],
hands: [
{
label: 'Left',
state: 'open_palm',
landmarks: [
{ name: 'wrist', x: 0.21, y: 0.31 },
{ name: 'index_mcp', x: 0.25, y: 0.33 },
{ name: 'middle_mcp', x: 0.27, y: 0.34 },
{ name: 'ring_mcp', x: 0.28, y: 0.35 },
{ name: 'pinky_mcp', x: 0.29, y: 0.36 },
],
},
{
label: 'Right',
state: 'unknown',
x: 0.72,
y: 0.32,
},
],
});
expect(command.bodyCenter).toEqual({x: 0.34, y: 0.58});
expect(command.actions).toEqual(
expect.arrayContaining(['wave_left_hand', 'open_palm']),
);
expect(command.leftHand).toEqual(
expect.objectContaining({side: 'left', source: 'palm_center'}),
);
expect(command.rightHand).toEqual(
expect.objectContaining({x: 0.72, y: 0.32, side: 'right'}),
);
});
});