Input
Input reads project Input Actions and physical PlayStation controller state.
Prefer semantic names for gameplay so bindings can change without rewriting
scripts; use physical constants for fixed platform conventions or diagnostics.
Buttons and Actions
function Update(gameObjectId, deltaTime)
if Input.GetButtonDown("Interact") then
Log.Print("Interact pressed")
end
if Input.GetButton(Input.R1) then
Transform.RotateY(gameObjectId, 60.0 * deltaTime)
end
end
| Method | Description |
|---|---|
Input.GetButton(buttonOrAction) | Held state. |
Input.GetButtonDown(buttonOrAction) | True on the pressed frame. |
Input.GetButtonUp(buttonOrAction) | True on the released frame. |
Physical constants are Input.CROSS, Input.CIRCLE, Input.SQUARE,
Input.TRIANGLE, D-pad Input.UP, Input.DOWN, Input.LEFT, Input.RIGHT,
Input.START, Input.SELECT, Input.L1, Input.L2, Input.L3, Input.R1,
Input.R2, and Input.R3.
Axes
Input.GetAxis(stickOrAction) returns two numbers in -1.0..1.0:
local moveX, moveY = Input.GetAxis("Move")
local lookX, lookY = Input.GetAxis("Look")
-- Physical-stick access is also available.
local leftX, leftY = Input.GetAxis(Input.STICK_LEFT)
Use Input.STICK_LEFT or Input.STICK_RIGHT for direct physical-stick access.
Digital D-pad input feeds the movement path when the project binding allows it. The right stick requires an analog-capable pad in analog mode. Apply a project- appropriate dead zone before using small analog values.
Device State
| Method | Returns | Description |
|---|---|---|
Input.IsConnected() | boolean | Reports a supported device on Port 1. |
Input.HasAnalog() | boolean | Reports analog-stick availability. |
Input.GetPadType() | integer | Returns the controller type code. |
L3/R3 and rumble depend on the connected controller and emulator mapping. A game must remain operable when analog input or vibration is unavailable.
Configure semantic axes and buttons in Project Settings > Input Action Map. The PS1 build bakes at most 32 fixed action records and resolves action names without per-frame allocation.
PlayerInput Component State
The PlayerInput table controls the authored PlayerInput component at runtime.
It does not replace raw Input queries.
| Method | Returns | Description |
|---|---|---|
PlayerInput.SetEnabled(gameObjectId, enabled) | boolean | Enables or disables native player movement, look, interaction, and interaction prompts. Returns false for an invalid GameObject or one without PlayerInput. |
PlayerInput.IsEnabled(gameObjectId) | boolean or nil | Returns the runtime component state, or nil when PlayerInput is absent. |
Disabling PlayerInput does not deactivate the GameObject or its LuaBehaviour.
The script can continue reading Input to drive a modal menu, dialogue choice,
cutscene skip, or other custom flow. The runtime state is restored from the
authored component when a scene starts or reloads.