Log inGet started
Package

headset_flight.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

headset_flight

The editor camera's flight in a headset: the person flies along the direction they look, head pitch included, and the speed follows how long they have been flying.

local Flight = require("@builtin::modules.headset_flight")

local state = Flight.newState()
local basis = Flight.basis(camera.facing(id, "forward"), camera.facing(id, "right"))
local dx, dy, dz = Flight.step(state, { strafe = 0, forward = 1, vertical = 0 }, basis, 5, 100, dt)

Exports

  • Flight.basis(forward, right?) -> Basis? the axes flown along: the view's forward in three dimensions, its right on the level plane, the world's up.
  • Flight.speed(base, top, held) -> number metres per second after held seconds of continuous flight: base at the start, top after Flight.RAMP_SECONDS (3), growing exponentially.
  • Flight.newState() -> State a flight at rest.
  • Flight.step(state, controls, basis, base, top, dt) -> dx, dy, dz advances the flight; the velocity eases towards its target over Flight.RESPONSE_SECONDS (0.12) and the speed returns to base after the controls rest for Flight.IDLE_RESET_SECONDS (0.3).