Telekinesis

Lets the player grab objects at a distance, hold them with bounded spring-and-damper forces, throw them and pay an energy cost, while the engine keeps the bodies and collisions.

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

Also read offline — CLI: grip-forge docs interaction-telekinesisMCP tool: gripforge_docs { "topic": "interaction-telekinesis" }

Telekinesis (interaction.telekinesis) #

What it is for #

Lets the player grab objects at a distance, hold them with bounded spring-and-damper forces, throw them and pay an energy cost, while the engine keeps the bodies and collisions.

It needs 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: "interaction.telekinesis" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "interaction.telekinesis",
                              config: { "maxMass": 50, "grabRange": 8 } }

First example #

<!-- test: kits/interaction_telekinesis/tests/interaction_telekinesis.rs::grabbing_takes_energy_only_once_the_engine_confirms --> This is the body of the passing test grabbing_takes_energy_only_once_the_engine_confirms; the helper functions it calls are defined at the top of the same test file.

#[test]
fn grabbing_takes_energy_only_once_the_engine_confirms() {
    let mut s = tk();
    let p = req(&mut s, KIT, grab_cmd("rock", 4.0, json!([0, 0, 3])));
    assert_eq!(
        p["action"]["effect"],
        json!({"kind": "grab", "body": "rock", "mass": 4.0})
    );
    assert_eq!(energy(&mut s), 20.0);
    resolve(&mut s, KIT, &p, true);
    assert_eq!(energy(&mut s), 15.0);
    assert_eq!(held(&mut s), json!({"id": "rock", "mass": 4.0}));
}

Settings and defaults #

Descriptions come from the kit manifest and stay in English.

SettingTypeDefaultRange or valuesMeaning
maxMassnumber500.001–100000Maximum movable object mass in kilograms (kg).
grabRangenumber80.01–1000Maximum initial actor-to-object distance in metres.
holdRangenumber60.01–1000Maximum desired target distance from the actor in metres.
breakRangenumber120.01–2000Distance in metres that releases a held body; at least grabRange and holdRange.
stiffnessnumber250–1000Position-error gain in inverse seconds squared for the hold acceleration.
dampingnumber100–1000Velocity damping gain in inverse seconds for the hold acceleration.
maxForcenumber15000.01–1000000000Maximum total holding force in newtons (N), including gravity compensation.
throwSpeednumber200–1000Desired throw speed relative to the actor in metres per second.
maxImpulsenumber5000.01–1000000000Maximum throwing impulse in newton seconds; may limit achieved speed.
maxEnergynumber1000.01–1000000Maximum stored telekinesis energy units.
grabCostnumber50–1000000Energy units charged only when grabbing is confirmed.
throwCostnumber100–1000000Energy units charged only when throwing is confirmed.
drainPerKgnumber0.10–1000Holding energy units spent per kilogram per second after confirmed force application.
energyRecoverynumber50–1000000Energy units recovered per idle simulation second.
releaseCooldownnumber0.20–60Cooldown in seconds after releasing or throwing a body.

Services, events, variables #

  • Service interaction.telekinesis: create(id,config), request(id,command), remove(id), ids(). Commands: grab, release, throw, step, resolve, preview, status, config, save, load. Engine effects require resolve(token,success).
  • Events emitted:
    • interaction.telekinesis.created (instance, preset) — An instance was created.
    • interaction.telekinesis.removed (instance) — An instance was removed.
    • interaction.telekinesis.changed (instance, op, result) — A decided command applied to an instance (never a read or a fixed step).
    • interaction.telekinesis.refused (instance, op, by, reason) — A tap of interaction.telekinesis.request cancelled a command.
  • Verbs of the scripting layer:
    • interaction_telekinesis_request (action) — Send a command to an instance of the kit (through the request hook).
    • interaction_telekinesis_exists (condition) — The instance exists (default: default).

Hooks and modding #

  • Hooks (a game or a mod can intercept them):
    • interaction.telekinesis.create (fields a tap may change: config; cancellable) — An instance is about to be created (create(id, config)).
    • interaction.telekinesis.request (fields a tap may change: command; cancellable) — A decided command (every op but the reads and the fixed steps) is about to apply to an instance.
  • Moddable settings: maxMass, grabRange, holdRange, breakRange, stiffness, damping, maxForce, throwSpeed, maxImpulse, maxEnergy, grabCost, throwCost, drainPerKg, energyRecovery, releaseCooldown
  • Moddable collections: interaction_telekinesis_presets

Engines #

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

Versions #

Kit version 1.1.0.