Skip to Content

Into a car

A driver and a passenger open the front doors, duck in to sit and nod.

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, HumanHabit, HumanObject, HumanObstacle, HumanPerformance, HumanTravelCar, HumanTravelLeaf } from "@automovie/motions";
import * as archetypes from "@automovie/archetypes";

const car = archetypes.createCar({ kind: "sedan" });
const carAt = { at: { x: 0, y: 0, z: 0 }, yaw: 0 };

// drv: body m1, at (1.6, -3.4) m, facing 0°, trained
const drv = HumanChain.subject("drv")
  .registered("checkWatch", {})
  .act("walk", { to: { x: 1.15, y: 0, z: -0.2 }, face: 270 })
  .registered("openDoor", { door: "car", handle: "driverDoorHandle", seconds: 0.9 })
  .act("walk", { to: { x: 0.75, y: 0, z: -0.2 }, face: 90 })
  .registered("getIn", {
      seat: HumanObject.seat(car, carAt, "driverSeat"),
      through: HumanObstacle.apertures(car, carAt).find((o) => o.id === "driverAperture")!,
    })
  .act("gesture", { kind: "nod" });

// pas: body f1, at (-1.6, -3.4) m, facing 0°, trained
const pas = HumanChain.subject("pas")
  .registered("checkPhone", { seconds: 2 })
  .act("walk", { to: { x: -1.15, y: 0, z: -0.2 }, face: 90 })
  .registered("openDoor", { door: "car", handle: "passengerDoorHandle", seconds: 0.9 })
  .act("walk", { to: { x: -0.75, y: 0, z: -0.2 }, face: 270 })
  .registered("getIn", {
      seat: HumanObject.seat(car, carAt, "passengerSeat"),
      through: HumanObstacle.apertures(car, carAt).find((o) => o.id === "passengerAperture")!,
    })
  .act("gesture", { kind: "nod" });

const scene = drv.with(pas);

// The lexicon's laws this scene's rows perform, registered with the performance.
const laws = [HumanHabit.checkWatch, HumanTravelLeaf.openDoor, HumanTravelCar.getIn, HumanHabit.checkPhone];

const props = [
  HumanObject.prop("car", car, carAt),
];

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

const input: IAutoMovieMotionHumanPerformance.IInput = {
  seed: "into-a-car",
  performers: [
    { subject: "drv", body: bodies["m1"]!, at: { x: 1.6, y: 0, z: -3.4 }, yaw: 0, proficiency: { level: "trained" } },
    { subject: "pas", body: bodies["f1"]!, at: { x: -1.6, y: 0, z: -3.4 }, yaw: 0, proficiency: { level: "trained" } },
  ],
  composition: scene.node,
  props,
  laws,
};
const performance = new HumanPerformance(input);