Skip to Content

Golf

One golfer tees off; another reads the green, putts and takes the ball from the cup.

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, HumanPerformance, HumanSport, HumanSportSwing } from "@automovie/motions";

// g1: body m1, at (-1, -1.4) m, facing 90°, trained
const g1 = HumanChain.subject("g1")
  .act("walk", { to: { x: -1, y: 0, z: 0 }, face: 90 })
  .act("crouch", { hold: 0.3 })
  .registered("golfAddress", {})
  .registered("golfSwing", {})
  .act("look", {
      target: {
        kind: "point",
        frame: "world",
        at: { x: 30, y: 12, z: 0 },
      },
      seconds: 1.4,
    })
  .act("crouch", { hold: 0.3 })
  .act("walk", { to: { x: -1, y: 0, z: -1 } });

// g2: body f1, at (1, 1) m, facing 90°, trained
const g2 = HumanChain.subject("g2")
  .act("crouch", { depth: "full", hold: 0.8 })
  .registered("golfAddress", {})
  .registered("putt", {})
  .act("look", {
      target: {
        kind: "point",
        frame: "world",
        at: { x: 3.5, y: 0, z: 1 },
      },
      seconds: 1,
    })
  .act("walk", { to: { x: 3.2, y: 0, z: 1 } })
  .act("crouch", { depth: "full", hold: 0.2 })
  .act("walk", { to: { x: 2.8, y: 0, z: 2.1 } });

const scene = g1.with(g2);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanSport.golfAddress, HumanSportSwing.golfSwing, HumanSportSwing.putt];

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

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "golf",
  performers: [
    { subject: "g1", body: bodies["m1"]!, at: { x: -1, y: 0, z: -1.4 }, yaw: 90, proficiency: { level: "trained" } },
    { subject: "g2", body: bodies["f1"]!, at: { x: 1, y: 0, z: 1 }, yaw: 90, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  laws,
};
const performance = new HumanPerformance(input);