Free flight

Lets the character fly: take off, climb, dive, cruise where the camera looks, boost and land, with an optional flight stamina that drains in the air and recovers on the ground.

Source: module-kits:kits/movement_flight/usage/en.mdView Markdown source

Also read offline — CLI: grip-forge docs movement-flightMCP tool: gripforge_docs { "topic": "movement-flight" }

Free flight (movement.flight) #

What it is for #

Lets the character fly: take off, climb, dive, cruise where the camera looks, boost and land, with an optional flight stamina that drains in the air and recovers on the ground.

It needs input.actions, character.control, physics.port, game.engine; installing it brings them in.

Turn it on #

Install the kit in a project, then change a setting (the values shown are its defaults):

gripforge_gamekit_install   { project_id: "gkp_…", id: "movement.flight" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "movement.flight",
                              config: { "cruiseSpeed": 12, "boostSpeed": 28 } }

First example #

The kit has no dedicated test yet; this installs it and sets two of its settings to their defaults.

gripforge_gamekit_install   { project_id: "gkp_…", id: "movement.flight" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "movement.flight",
                              config: { "cruiseSpeed": 12, "boostSpeed": 28 } }

Settings and defaults #

Descriptions come from the kit manifest and stay in English.

SettingTypeDefaultRange or valuesMeaning
cruiseSpeednumber121–200Horizontal speed in the air (m/s).
boostSpeednumber281–400Speed while sprint is held (m/s).
climbSpeednumber70.5–100Climb and dive speed (m/s).
accelnumber181–200How fast the speed follows the stick (m/s²).
takeoffSpeednumber50–30Upward speed given at take-off (m/s).
takeoffHeightnumber20–50After a take-off the flier climbs (at climbSpeed) until it is this many metres above where it left the ground, unless descend is…
doubleJumpTakeoffbooleantrueA second press of jump in the air takes off (besides the flight key).
pitchSteerbooleanfalseThe vertical speed also follows where the camera looks (the eyes of a first-person character, the free-look camera): climb by…
maxAltitudenumber00–5000Metres above the ground the flier cannot climb past (0: no ceiling).
landingHeightnumber0.60.05–5Diving to this height above the ground lands.
hoverSinknumber00–20Slow sink in m/s when neither climb nor dive is held (0: the flier hovers in place).
staminanumber00–10000Flight stamina (0: unlimited flight).
drainnumber60–1000Stamina spent per second in the air.
boostDrainnumber140–1000Stamina spent per second of boost (instead of drain).
regennumber120–1000Stamina back per second on the ground.
regenDelaynumber10–30Seconds on the ground before the stamina comes back.
recoverRationumber0.30–1An exhausted flier takes off again once its stamina is back to this share of the maximum.

Services, events, variables #

  • Service movement.flight: flying() → view|null, takeOff(), land(), boost(on), stamina(), altitude(), speed(); the hooks flight.takeoff, flight.land, flight.boost (held) and flight.zone (held per zone).
  • Events emitted:
    • flight.takeoff (entity, x, y, z, how) — The flier left the ground.
    • flight.landed (entity, x, y, z, seconds, reason) — The flight ended: on the ground, asked for, out of stamina, refused by a zone, or the flier left the world (then it falls).
    • flight.boost (entity, on) — The boost started (on) or stopped.
    • flight.exhausted (entity) — The flight stamina is empty: the flier comes down and cannot take off until recoverRatio is back.
    • flight.recovered (entity) — An exhausted flier can take off again.
    • flight.refused (entity, decision, reason) — A tap of one of the kit's hooks cancelled a decision (never emitted without a tap).
  • Variables:
    • flight.flying (boolean) — Flying
    • flight.altitude (number) — Altitude
    • flight.speed (number) — Flight speed
    • flight.boosting (boolean) — Boosting
    • flight.stamina (number) — Flight stamina
    • flight.stamina.max (number) — Flight stamina maximum
  • Verbs of the scripting layer:
    • take_off (action) — The player takes off (through the hook flight.takeoff).
    • land (action) — The player stops flying and falls to the ground (through the hook flight.land).
    • is_flying (condition) — The player is in flight.
  • Input actions: fly_toggle, fly_down

Hooks and modding #

  • Hooks (a game or a mod can intercept them):
    • flight.takeoff (fields a tap may change: speed; cancellable) — The player is about to take off (the flight key, a second jump in the air, takeOff(), the take_off action): speed is the upward speed given, stamina what is left (the maximum when unlimited).
    • flight.land (cancellable) — The flier asks to stop flying in the air (the flight key, land(), the land action) and would fall from altitude metres.
    • flight.boost (fields a tap may change: speed; cancellable) — The flier is about to boost (sprint held in the air): speed is the boost speed.
    • flight.zone (cancellable) — Whether flying is allowed where the flier is: zones are the ids of the zones it is inside (none: the open world).
  • Moddable settings: cruiseSpeed, boostSpeed, climbSpeed, accel, takeoffSpeed, takeoffHeight, doubleJumpTakeoff, pitchSteer, maxAltitude, landingHeight, hoverSink, stamina, drain, boostDrain, regen, regenDelay, recoverRatio

Engines #

Declared targets: web, rust. gripforge kit api movement.flight lists the exact settings and services of your version.

Versions #

Kit version 1.0.0.