aeronautic

Without React

Contrails, the plain three.js class underneath.

<Contrails> is a thin layer over the Contrails class from the package root. Without React, make one, add its mesh to the scene and point it at the object it follows:

import { Contrails } from "@aeronautic/contrails";

const trails = new Contrails({
  object: jet, // the model, or any node of it
  frame: { forward: [0, 0, -1], up: [0, 1, 0] },
  airframe: {
    engines: [
      [-0.75, 0.05, 7],
      [0.75, 0.05, 7],
    ],
  },
  air: { altitudeM: 11_000, relativeHumidity: 0.66 },
  look: { sunDirection: [5, 10, 5] },
});

scene.add(trails.mesh);

// Every frame
trails.updateFlight({ airspeedMPerS: 250, loadFactor: 2 });

The mesh is placed in world space by hand, wherever it is parented, and updates itself in its onBeforeRender: once a frame it records where the aircraft is and how it is flying, and lays the trails through the air it has flown. Everything else is worked out when a dial changes.

The trails are laid from the time the frames give. After a jump, a teleport or a paused tab, start them again:

trails.reset();

And free it when you are done:

trails.dispose();

Its state

trails.state says what the physics made of the day:

fieldwhat it is
airThe day's air: temperature, pressure, density, vapour.
iceHumidityIts humidity over ice. Over 1, a trail persists.
criterionThe Schmidt–Appleman criterion: forms, thresholdK, the slope.
formationThe dilutions at which the plume saturates and freezes.
efficiencyHow much of the fuel's heat pushes the aircraft.
fuelPerMetreKgEach engine's fuel per metre flown.
wakeThe vortex pair: spacing, circulation, descent.
visibleWhether a trail forms at all.
persistentWhether it lasts.

Every method is in the reference.

On this page