InputState
此内容尚不支持你的语言。
Defined in: input.ts:57
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new InputState():
InputState
Returns
Section titled “Returns”InputState
Properties
Section titled “Properties”gamepadButtonThreshold
Section titled “gamepadButtonThreshold”gamepadButtonThreshold:
number=0.5
Defined in: input.ts:172
Analog buttons (e.g. triggers) count as “down” at/above this value.
gamepadDeadzone
Section titled “gamepadDeadzone”gamepadDeadzone:
number=0.15
Defined in: input.ts:174
Axis magnitudes below this read as 0 (rest-position stick jitter).
gamepads
Section titled “gamepads”gamepads:
Map<number,PadState>
Defined in: input.ts:170
Per-index pad state; an index persists across disconnect so a reconnect resumes.
keysDown
Section titled “keysDown”keysDown:
Set<string>
Defined in: input.ts:58
keysPressed
Section titled “keysPressed”keysPressed:
Set<string>
Defined in: input.ts:59
keysPressedFixed
Section titled “keysPressedFixed”keysPressedFixed:
Set<string>
Defined in: input.ts:83
keysReleased
Section titled “keysReleased”keysReleased:
Set<string>
Defined in: input.ts:60
keysReleasedFixed
Section titled “keysReleasedFixed”keysReleasedFixed:
Set<string>
Defined in: input.ts:84
mouseButtons
Section titled “mouseButtons”mouseButtons:
Set<number>
Defined in: input.ts:63
mouseButtonsPressed
Section titled “mouseButtonsPressed”mouseButtonsPressed:
Set<number>
Defined in: input.ts:64
mouseButtonsPressedFixed
Section titled “mouseButtonsPressedFixed”mouseButtonsPressedFixed:
Set<number>
Defined in: input.ts:85
mouseButtonsReleased
Section titled “mouseButtonsReleased”mouseButtonsReleased:
Set<number>
Defined in: input.ts:65
mouseButtonsReleasedFixed
Section titled “mouseButtonsReleasedFixed”mouseButtonsReleasedFixed:
Set<number>
Defined in: input.ts:86
mouseX
Section titled “mouseX”mouseX:
number=0
Defined in: input.ts:61
mouseY
Section titled “mouseY”mouseY:
number=0
Defined in: input.ts:62
pointerOverUI
Section titled “pointerOverUI”pointerOverUI:
boolean=false
Defined in: input.ts:228
True when the pointer is over an interactive UI element this frame (set each
frame by the UI interaction system). Gameplay checks this to ignore input
the UI handled — e.g. don’t fire a weapon when clicking a HUD button.
Unity’s EventSystem.IsPointerOverGameObject() analog.
scrollDeltaX
Section titled “scrollDeltaX”scrollDeltaX:
number=0
Defined in: input.ts:66
scrollDeltaY
Section titled “scrollDeltaY”scrollDeltaY:
number=0
Defined in: input.ts:67
touches
Section titled “touches”touches:
Map<number,TouchPoint>
Defined in: input.ts:69
touchesEnded
Section titled “touchesEnded”touchesEnded:
Set<number>
Defined in: input.ts:71
touchesStarted
Section titled “touchesStarted”touchesStarted:
Map<number,TouchPoint>
Defined in: input.ts:70
Methods
Section titled “Methods”beginFixedStep()
Section titled “beginFixedStep()”beginFixedStep():
void
Defined in: input.ts:264
Enter a fixed-timestep step: keyboard/mouse edge queries now read the fixed mirrors. Called by App before each FixedUpdate step.
Returns
Section titled “Returns”void
clearFrameState()
Section titled “clearFrameState()”clearFrameState():
void
Defined in: input.ts:251
Returns
Section titled “Returns”void
endFixedStep()
Section titled “endFixedStep()”endFixedStep():
void
Defined in: input.ts:272
Leave a fixed step: drop the consumed edges (so a later step this frame doesn’t see them again) and restore the render context. Edges that arrived on a frame with no fixed step are never cleared here, so they survive to the next frame’s first step instead of being lost.
Returns
Section titled “Returns”void
getGamepadAxis()
Section titled “getGamepadAxis()”getGamepadAxis(
axis,pad?):number
Defined in: input.ts:212
Signed axis value in [-1,1], with the deadzone applied.
Parameters
Section titled “Parameters”number
number = 0
Returns
Section titled “Returns”number
getGamepadButtonValue()
Section titled “getGamepadButtonValue()”getGamepadButtonValue(
button,pad?):number
Defined in: input.ts:207
Raw analog value of a button in [0,1] (triggers; 0/1 for digital buttons).
Parameters
Section titled “Parameters”button
Section titled “button”number
number = 0
Returns
Section titled “Returns”number
getGamepads()
Section titled “getGamepads()”getGamepads():
number[]
Defined in: input.ts:177
Indices of currently-connected gamepads.
Returns
Section titled “Returns”number[]
getMousePosition()
Section titled “getMousePosition()”getMousePosition():
object
Defined in: input.ts:101
Returns
Section titled “Returns”object
x:
number
y:
number
getScrollDelta()
Section titled “getScrollDelta()”getScrollDelta():
object
Defined in: input.ts:148
Returns
Section titled “Returns”object
x:
number
y:
number
getTouch()
Section titled “getTouch()”getTouch(
id):TouchPoint|null
Defined in: input.ts:160
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”TouchPoint | null
getTouchCount()
Section titled “getTouchCount()”getTouchCount():
number
Defined in: input.ts:156
Returns
Section titled “Returns”number
getTouches()
Section titled “getTouches()”getTouches():
TouchPoint[]
Defined in: input.ts:152
Returns
Section titled “Returns”isGamepadButtonDown()
Section titled “isGamepadButtonDown()”isGamepadButtonDown(
button,pad?):boolean
Defined in: input.ts:187
Parameters
Section titled “Parameters”button
Section titled “button”number
number = 0
Returns
Section titled “Returns”boolean
isGamepadButtonPressed()
Section titled “isGamepadButtonPressed()”isGamepadButtonPressed(
button,pad?):boolean
Defined in: input.ts:192
Parameters
Section titled “Parameters”button
Section titled “button”number
number = 0
Returns
Section titled “Returns”boolean
isGamepadButtonReleased()
Section titled “isGamepadButtonReleased()”isGamepadButtonReleased(
button,pad?):boolean
Defined in: input.ts:199
Parameters
Section titled “Parameters”button
Section titled “button”number
number = 0
Returns
Section titled “Returns”boolean
isGamepadConnected()
Section titled “isGamepadConnected()”isGamepadConnected(
pad?):boolean
Defined in: input.ts:183
Parameters
Section titled “Parameters”number = 0
Returns
Section titled “Returns”boolean
isKeyDown()
Section titled “isKeyDown()”isKeyDown(
key):boolean
Defined in: input.ts:89
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
isKeyPressed()
Section titled “isKeyPressed()”isKeyPressed(
key):boolean
Defined in: input.ts:93
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
isKeyReleased()
Section titled “isKeyReleased()”isKeyReleased(
key):boolean
Defined in: input.ts:97
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
isMouseButtonDown()
Section titled “isMouseButtonDown()”isMouseButtonDown(
button):boolean
Defined in: input.ts:105
Parameters
Section titled “Parameters”button
Section titled “button”number
Returns
Section titled “Returns”boolean
isMouseButtonPressed()
Section titled “isMouseButtonPressed()”isMouseButtonPressed(
button):boolean
Defined in: input.ts:109
Parameters
Section titled “Parameters”button
Section titled “button”number
Returns
Section titled “Returns”boolean
isMouseButtonReleased()
Section titled “isMouseButtonReleased()”isMouseButtonReleased(
button):boolean
Defined in: input.ts:113
Parameters
Section titled “Parameters”button
Section titled “button”number
Returns
Section titled “Returns”boolean
isPointerOverUI()
Section titled “isPointerOverUI()”isPointerOverUI():
boolean
Defined in: input.ts:230
Returns
Section titled “Returns”boolean
isTouchActive()
Section titled “isTouchActive()”isTouchActive(
id):boolean
Defined in: input.ts:164
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”boolean
noteKeyDown()
Section titled “noteKeyDown()”noteKeyDown(
code):void
Defined in: input.ts:122
Record a key-down. The pressed edge only fires on the transition, so a browser’s auto-repeat keydown for a held key doesn’t re-trigger it.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
noteKeyUp()
Section titled “noteKeyUp()”noteKeyUp(
code):void
Defined in: input.ts:130
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
noteMouseDown()
Section titled “noteMouseDown()”noteMouseDown(
button):void
Defined in: input.ts:136
Parameters
Section titled “Parameters”button
Section titled “button”number
Returns
Section titled “Returns”void
noteMouseUp()
Section titled “noteMouseUp()”noteMouseUp(
button):void
Defined in: input.ts:142
Parameters
Section titled “Parameters”button
Section titled “button”number
Returns
Section titled “Returns”void
updateGamepads()
Section titled “updateGamepads()”updateGamepads(
snapshots):void
Defined in: input.ts:236
Ingest this frame’s snapshots: shift current→prev (edge detection) then
store new values. Pads absent from snapshots are marked disconnected.
Parameters
Section titled “Parameters”snapshots
Section titled “snapshots”Returns
Section titled “Returns”void