Skip to Content

Ball yard

A catcher takes a throw and passes it to a kicker, who catches it and kicks two balls.

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, HumanGait, HumanGestureRows, HumanObject, HumanPerformance, HumanSportThrow, HumanStance } from "@automovie/motions";
import * as archetypes from "@automovie/archetypes";

const handball = archetypes.createBall({ kind: "handball" });
const handballAt = { at: { x: 0, y: 0, z: 0.3 }, yaw: 0 };
const football = archetypes.createBall({ kind: "football" });
const footballAt = { at: { x: 1.7, y: 0, z: 2 }, yaw: 0 };
const football2 = archetypes.createBall({ kind: "football" });
const football2At = { at: { x: 1.7, y: 0, z: 1.3 }, yaw: 0 };

// th: body m1, at (0, 0) m, facing 0°, trained
const th = HumanChain.subject("th")
  .act("throwObject", { at: { kind: "person", subject: "ca", region: "sternum" } }, "th")
  .act("run", { to: { x: 0, y: 0, z: 1.6 }, pace: "jog" })
  .registered("gestureBeckon", {})
  .act("jump", { to: { x: 0, y: 0, z: 1.8 } })
  .registered("jog", { to: { x: -1.5, y: 0, z: 2.6 }, face: 45 })
  .registered("fistPump", {})
  .act("walk", { to: { x: -0.4, y: 0, z: 1.8 }, face: 0 });

// ca: body f1, at (0, 5) m, facing 180°, trained
const ca = HumanChain.subject("ca")
  .act("catchObject", { from: "th", hands: "two", ball: "handball" })
  .act("throwObject", {
      at: { kind: "person", subject: "ki", region: "sternum" },
      prop: "handball",
      style: "underarm",
    }, "by-pass")
  .registered("gestureClap", {})
  .act("jump", { to: { x: 0, y: 0, z: 4.6 } })
  .registered("jog", { to: { x: -0.8, y: 0, z: 5.4 }, face: 180 })
  .registered("fistPump", {})
  .registered("handsOnHips", { seconds: 1.6 });

// ki: body m2, at (2, 2) m, facing 270°, trained
const ki = HumanChain.subject("ki")
  .act("kickBall", { ball: "football" })
  .registered("gestureBeckon", {})
  .act("catchObject", { from: "by-pass", hands: "two", ball: "handball" })
  .act("walk", { to: { x: 2, y: 0, z: 1.3 }, face: 270 })
  .registered("kickLeft", { ball: "football2" })
  .registered("gestureCheer", {})
  .registered("jog", { to: { x: 0.8, y: 0, z: 1.6 }, face: 270 });

const scene = th.with(ca, ki);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanGestureRows.gestureBeckon, HumanGait.jog, HumanStance.fistPump, HumanGestureRows.gestureClap, HumanStance.handsOnHips, HumanSportThrow.kickLeft, HumanGestureRows.gestureCheer];

const props = [
  HumanObject.prop("handball", handball, handballAt),
  HumanObject.prop("football", football, footballAt),
  HumanObject.prop("football2", football2, football2At),
];

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

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "ball-yard",
  performers: [
    { subject: "th", body: bodies["m1"]!, at: { x: 0, y: 0, z: 0 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "ca", body: bodies["f1"]!, at: { x: 0, y: 0, z: 5 }, yaw: 180, proficiency: { level: "trained" } },
    { subject: "ki", body: bodies["m2"]!, at: { x: 2, y: 0, z: 2 }, yaw: 270, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  props,
  laws,
};
const performance = new HumanPerformance(input);