feat: add child motion picture book stage tooling
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -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'}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user