Skip to Content

Firing range

Three shooters each take a handgun off their bench: low ready, an aim, a shot, the support palm pressed once to the magazine well, and high ready.

The packages refuse this scene today, in their own words on the view below. #3528 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, HumanFirearm, HumanObject, HumanPerformance, HumanWeaponFirearm, HumanWeaponMelee } from "@automovie/motions";
import * as archetypes from "@automovie/archetypes";

const bench1 = archetypes.createTable({ kind: "counter" });
const bench1At = { at: { x: -2.2, y: 0, z: 0.53 }, yaw: 180 };
const gun1 = archetypes.createHandgun({ frame: "compact" });
const gun1At = { at: { x: -2.3800000000000003, y: 0.914, z: 0.3 }, yaw: 0 };
const bench2 = archetypes.createTable({ kind: "counter" });
const bench2At = { at: { x: 0, y: 0, z: 0.53 }, yaw: 180 };
const gun2 = archetypes.createHandgun({ frame: "compact" });
const gun2At = { at: { x: -0.18, y: 0.914, z: 0.3 }, yaw: 0 };
const bench3 = archetypes.createTable({ kind: "counter" });
const bench3At = { at: { x: 2.2, y: 0, z: 0.53 }, yaw: 180 };
const gun3 = archetypes.createHandgun({ frame: "compact" });
const gun3At = { at: { x: 2.02, y: 0.914, z: 0.3 }, yaw: 0 };

// f1: body m1, at (-2.2, 0) m, facing 0°, trained
const f1 = HumanChain.subject("f1")
  .registered("drawFirearm", { prop: "gun1" })
  .registered("lowReady", { gun: "gun1" })
  .registered("takeAim", {
      gun: "gun1",
      target: {
        kind: "point",
        at: { x: -2.2, y: 1.4, z: 10 },
        frame: "world",
      },
    })
  .registered("recoil", { gun: "gun1" })
  .registered("reloadFirearm", {
      target: { kind: "prop", subject: "gun1", point: "magazine" },
    })
  .registered("highReady", { gun: "gun1", seconds: 1 });

// f2: body f1, at (0, 0) m, facing 0°, trained
const f2 = HumanChain.subject("f2")
  .registered("drawFirearm", { prop: "gun2" })
  .registered("lowReady", { gun: "gun2" })
  .registered("takeAim", {
      gun: "gun2",
      target: {
        kind: "point",
        at: { x: 0, y: 1.4, z: 10 },
        frame: "world",
      },
    })
  .registered("recoil", { gun: "gun2" })
  .registered("reloadFirearm", {
      target: { kind: "prop", subject: "gun2", point: "magazine" },
    })
  .registered("highReady", { gun: "gun2", seconds: 1 });

// f3: body m2, at (2.2, 0) m, facing 0°, trained
const f3 = HumanChain.subject("f3")
  .registered("drawFirearm", { prop: "gun3" })
  .registered("lowReady", { gun: "gun3" })
  .registered("takeAim", {
      gun: "gun3",
      target: {
        kind: "point",
        at: { x: 2.2, y: 1.4, z: 10 },
        frame: "world",
      },
    })
  .registered("recoil", { gun: "gun3" })
  .registered("reloadFirearm", {
      target: { kind: "prop", subject: "gun3", point: "magazine" },
    })
  .registered("highReady", { gun: "gun3", seconds: 1 });

const scene = f1.with(f2, f3);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanWeaponFirearm.draw, HumanFirearm.lowReady, HumanFirearm.takeAim, HumanFirearm.recoil, HumanWeaponMelee.reload, HumanFirearm.highReady];

const props = [
  HumanObject.prop("bench1", bench1, bench1At),
  HumanObject.prop("gun1", gun1, gun1At),
  HumanObject.prop("bench2", bench2, bench2At),
  HumanObject.prop("gun2", gun2, gun2At),
  HumanObject.prop("bench3", bench3, bench3At),
  HumanObject.prop("gun3", gun3, gun3At),
];

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

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "range",
  performers: [
    { subject: "f1", body: bodies["m1"]!, at: { x: -2.2, y: 0, z: 0 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "f2", body: bodies["f1"]!, at: { x: 0, y: 0, z: 0 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "f3", body: bodies["m2"]!, at: { x: 2.2, y: 0, z: 0 }, yaw: 0, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  props,
  laws,
};
const performance = new HumanPerformance(input);