Skip to Content

Shoot-around

A guard passes to a forward, contests his shot at the rim and shakes her head.

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

const ball = archetypes.createBall({ kind: "basketball" });
const ballAt = { at: { x: 0, y: 0, z: 1.69 }, yaw: 0 };
const hoop = archetypes.createGoal({ ring: 0.45, thickness: 0.013, kind: "basketballHoop" });
const hoopAt = { at: { x: 0, y: 0, z: -0.85 }, yaw: 0, fixed: true };
const hoop_pier = archetypes.createWall({ height: 0.43, length: 3, thickness: 0.2, kind: "low" });
const hoop_pierAt = { position: { x: 0.8, y: 1.5, z: -0.962 }, rotation: { x: 0, y: 0, z: 0.7071067811865476, w: 0.7071067811865476 }, fixed: true };

// eli: body f2, at (0, -0.6) m, facing 0°, trained
const eli = HumanChain.subject("eli")
  .act("gesture", { kind: "clap", count: 3 })
  .registered("jog", { to: { x: 0, y: 0, z: 1.2 }, face: 0 })
  .act("pickUp", { prop: "ball", handle: "grip", lift: 0.15 })
  .act("look", {
      with: "trunk",
      target: { kind: "person", subject: "fen", region: "face" },
    })
  .act("ballSport", {
      kind: "chestPass",
      prop: "ball",
      at: { x: 0, y: 1.3, z: 3.45 },
      flightSeconds: 0.42,
    }, "chest")
  .registered("defensiveSlide", {})
  .act("ballSport", { kind: "highHandContest", at: { x: 0, y: 1.9, z: 4 } }, "contest")
  .sync({
      of: "chest",
      event: "stroke",
      align: "stroke",
      offset: 3.18,
    })
  .act("look", {
      with: "trunk",
      cue: "seen",
      target: {
        kind: "point",
        frame: "world",
        at: { x: 0, y: 3.05, z: -0.474 },
      },
    })
  .act("gesture", { kind: "shakeHead" });

// fen: body m1, at (2.4, 5.2) m, facing 270°, trained
const fen = HumanChain.subject("fen")
  .registered("jog", { to: { x: 1.6, y: 0, z: 6.6 } })
  .registered("jog", { to: { x: 0, y: 0, z: 4 }, face: 180 })
  .act("gesture", { kind: "raiseHand", side: "left" })
  .registered("stageCatch", { from: "chest", ball: "ball", intercept: 0.42 })
  .sync({ of: "chest" })
  .act("ballSport", {
      kind: "setShot",
      prop: "ball",
      at: { x: 0, y: 3.05, z: -0.474 },
      flightSeconds: 1.12,
    }, "basket-shot")
  .sync({
      of: "chest",
      event: "stroke",
      align: "stroke",
      offset: 3.18,
    })
  .registered("fistPump", {});

const scene = eli.with(fen);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanGait.jog, HumanSport.defensiveSlide, stageCatch, HumanStance.fistPump];

const props = [
  HumanObject.prop("ball", ball, ballAt),
  HumanObject.prop("hoop", hoop, hoopAt),
  HumanObject.prop("hoop-pier", hoop_pier, hoop_pierAt),
];

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

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "shoot-around",
  performers: [
    { subject: "eli", body: bodies["f2"]!, at: { x: 0, y: 0, z: -0.6 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "fen", body: bodies["m1"]!, at: { x: 2.4, y: 0, z: 5.2 }, yaw: 270, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  props,
  laws,
};
const performance = new HumanPerformance(input);