Skip to Content

At bat

A pitcher throws overarm and then underarm, the batter swings, checks a swing and bunts, the catcher crouches and catches in the gloved hand, a fielder takes a grounder.

The packages refuse this scene today, in their own words on the view below. #3552 fixes it.

Computing 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, HumanSportThrow } from "@automovie/motions";

// pit: body m2, at (0, 6) m, facing 180°, trained
const pit = HumanChain.subject("pit")
  .act("stand", { seconds: 1.6 })
  .registered("pitch", {
      at: { kind: "person", subject: "cat", region: "palmLeft" },
    }, "pit")
  .registered("underarmPitch", {
      at: { kind: "person", subject: "cat", region: "palmLeft" },
    });

// bat: body m1, at (0.9, 0.7) m, facing 270°, trained
const bat = HumanChain.subject("bat")
  .registered("battingStance", {})
  .registered("batSwing", {})
  .registered("checkSwing", {})
  .registered("bunt", {});

// cat: body f2, at (0, 0) m, facing 0°, trained
const cat = HumanChain.subject("cat")
  .registered("catcherCrouch", { seconds: 1 })
  .registered("gloveCatch", { from: "pit", side: "left" });

// fie: body f1, at (3, 8) m, facing 200°, trained
const fie = HumanChain.subject("fie")
  .act("stand", { seconds: 1 })
  .registered("fieldGrounder", {});

const scene = pit.with(bat, cat, fie);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanSportThrow.pitch, HumanSportThrow.underarmPitch, HumanSport.battingStance, HumanSportSwing.batSwing, HumanSportSwing.checkSwing, HumanSportSwing.bunt, HumanSport.catcherCrouch, HumanSportThrow.gloveCatch, HumanSport.fieldGrounder];

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

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "baseball",
  performers: [
    { subject: "pit", body: bodies["m2"]!, at: { x: 0, y: 0, z: 6 }, yaw: 180, proficiency: { level: "trained" } },
    { subject: "bat", body: bodies["m1"]!, at: { x: 0.9, y: 0, z: 0.7 }, yaw: 270, proficiency: { level: "trained" } },
    { subject: "cat", body: bodies["f2"]!, at: { x: 0, y: 0, z: 0 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "fie", body: bodies["f1"]!, at: { x: 3, y: 0, z: 8 }, yaw: 200, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  laws,
};
const performance = new HumanPerformance(input);