headset_flight.module
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) -> numbermetres per second afterheldseconds of continuous flight:baseat the start,topafterFlight.RAMP_SECONDS(3), growing exponentially.Flight.newState() -> Statea flight at rest.Flight.step(state, controls, basis, base, top, dt) -> dx, dy, dzadvances the flight; the velocity eases towards its target overFlight.RESPONSE_SECONDS(0.12) and the speed returns tobaseafter the controls rest forFlight.IDLE_RESET_SECONDS(0.3).