Skip to Content

Workshop

Two carpenters hammer and saw at a bench while two porters carry and haul loads.

Loading the take.

Each person is a chain of typed actions from @automovie/motions. This is what an agent writes for the scene; Composing motion explains the parts.

import type { IAutoMovieMotionHumanBody, IAutoMovieMotionHumanPerformance } from "@automovie/interface";
import { HumanChain, HumanLabour, HumanObject, HumanPerformance } from "@automovie/motions";
import * as archetypes from "@automovie/archetypes";

const bench = archetypes.createTable({ kind: "counter" });
const benchAt = { at: { x: -0.5, y: 0, z: 0.65 }, yaw: 180 };
const hammerA = archetypes.createTool({ kind: "hammer" });
const hammerAAt = { position: { x: -1.13, y: 0.914, z: 0.42 }, rotation: { x: 0.7071067811865476, y: 0, z: 0, w: 0.7071067811865476 } };
const sawA = archetypes.createTool({ kind: "saw" });
const sawAAt = { position: { x: -1.03, y: 0.914, z: 0.42 }, rotation: { x: 0.7071067811865476, y: 0, z: 0, w: 0.7071067811865476 } };
const hammerB = archetypes.createTool({ kind: "hammer" });
const hammerBAt = { position: { x: -0.23, y: 0.914, z: 0.42 }, rotation: { x: 0.7071067811865476, y: 0, z: 0, w: 0.7071067811865476 } };

// w1: body m2, at (-0.95, 0.12) m, facing 0°, trained
const w1 = HumanChain.subject("w1")
  .act("pickUp", {
      prop: "hammerA",
      handle: "grip",
      use: { tip: "face", line: "square" },
    })
  .registered("hammer", {
      prop: "hammerA",
      on: {
        kind: "point",
        at: { x: -1.05, y: 0.914, z: 0.4 },
        frame: "world",
      },
    })
  .act("putDown", { prop: "hammerA", at: { x: -1.13, z: 0.42, y: 0.914 } })
  .act("pickUp", {
      prop: "sawA",
      handle: "grip",
      use: { tip: "face", line: "forearm" },
    })
  .registered("saw", {
      prop: "sawA",
      on: {
        kind: "point",
        at: { x: -1.05, y: 0.914, z: 0.4 },
        frame: "world",
      },
      cycles: 5,
    })
  .act("putDown", { prop: "sawA", at: { x: -1.03, z: 0.42, y: 0.914 } })
  .act("pickUp", {
      prop: "hammerA",
      handle: "grip",
      use: { tip: "face", line: "square" },
    })
  .registered("hammer", {
      prop: "hammerA",
      on: {
        kind: "point",
        at: { x: -1.05, y: 0.914, z: 0.4 },
        frame: "world",
      },
    })
  .act("putDown", { prop: "hammerA", at: { x: -1.13, z: 0.42, y: 0.914 } });

// w2: body f1, at (-0.05, 0.12) m, facing 0°, trained
const w2 = HumanChain.subject("w2")
  .act("pickUp", {
      prop: "hammerB",
      handle: "grip",
      use: { tip: "face", line: "square" },
    })
  .act("useTool", {
      tool: "hammer",
      prop: "hammerB",
      on: {
        kind: "point",
        at: { x: -0.15, y: 0.914, z: 0.4 },
        frame: "world",
      },
    })
  .act("putDown", { prop: "hammerB", at: { x: -0.23, z: 0.42, y: 0.914 } })
  .act("wipe", {
      on: {
        kind: "point",
        at: { x: -0.05, y: 0.914, z: 0.4 },
        frame: "world",
      },
      cycles: 4,
    })
  .act("gesture", { kind: "touchFace", region: "forehead" })
  .act("pickUp", {
      prop: "hammerB",
      handle: "grip",
      use: { tip: "face", line: "square" },
    })
  .act("useTool", {
      tool: "hammer",
      prop: "hammerB",
      on: {
        kind: "point",
        at: { x: -0.15, y: 0.914, z: 0.4 },
        frame: "world",
      },
    });

// w3: body m2, at (1.5, -1) m, facing 0°, trained
const w3 = HumanChain.subject("w3")
  .registered("carryBox", { to: { x: 1.5, y: 0, z: 2 } })
  .registered("pushCart", { to: { x: 1.5, y: 0, z: -1 } })
  .registered("haul", { to: { x: 1.5, y: 0, z: 1.2 } })
  .act("gesture", { kind: "nod" });

// w4: body f2, at (-2.5, 1) m, facing 0°, trained
const w4 = HumanChain.subject("w4")
  .act("carry", { to: { x: -2.5, y: 0, z: 1.8 }, how: "twoHands" })
  .registered("carryOnHip", { to: { x: -2.5, y: 0, z: 2.5 } })
  .registered("toss", { at: { kind: "person", subject: "w3", region: "sternum" } })
  .act("walk", { to: { x: -2.5, y: 0, z: 1.3 } })
  .registered("haul", { to: { x: -2.5, y: 0, z: 2.2 } })
  .act("gesture", { kind: "touchFace", region: "forehead" });

const scene = w1.with(w2, w3, w4);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanLabour.hammer, HumanLabour.saw, HumanLabour.carryBox, HumanLabour.pushCart, HumanLabour.haul, HumanLabour.carryOnHip, HumanLabour.toss];

const props = [
  HumanObject.prop("bench", bench, benchAt),
  HumanObject.prop("hammerA", hammerA, hammerAAt),
  HumanObject.prop("sawA", sawA, sawAAt),
  HumanObject.prop("hammerB", hammerB, hammerBAt),
];

// Each body id's motion body, prepared from the site's measures.
declare const bodies: Record<string, IAutoMovieMotionHumanBody>;

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "workshop",
  performers: [
    { subject: "w1", body: bodies["m2"]!, at: { x: -0.95, y: 0, z: 0.12 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "w2", body: bodies["f1"]!, at: { x: -0.05, y: 0, z: 0.12 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "w3", body: bodies["m2"]!, at: { x: 1.5, y: 0, z: -1 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "w4", body: bodies["f2"]!, at: { x: -2.5, y: 0, z: 1 }, yaw: 0, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  props,
  laws,
};
const performance = new HumanPerformance(input);