Skip to content

Commit a3f71a2

Browse files
update Open Source Docs from Roblox internal teams
1 parent 752a30e commit a3f71a2

File tree

4 files changed

+234
-54
lines changed

4 files changed

+234
-54
lines changed

content/en-us/reference/engine/classes/InputAction.yaml

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
name: InputAction
22
type: class
33
memory_category: Instances
4-
summary: ''
5-
description: ''
4+
summary: |
5+
Defines a gameplay action mechanic. These actions are then mapped to hardware
6+
inputs using `Class.InputBinding`.
7+
description: |
8+
`InputAction` defines a gameplay action mechanic such as "Jump," "Sprint," or
9+
"Shoot." These actions are then mapped to hardware inputs using
10+
`Class.InputBinding`. An `InputAction` will check for its first ancestor type
11+
of `Class.InputContext` and register itself to that context (if there is no
12+
ancestor context, it will be registered to a default context).
613
code_samples: []
714
inherits:
815
- Instance
@@ -11,8 +18,11 @@ tags:
1118
deprecation_message: ''
1219
properties:
1320
- name: InputAction.Enabled
14-
summary: ''
15-
description: ''
21+
summary: |
22+
Determines if the `InputAction` is enabled or not.
23+
description: |
24+
Determines if the `InputAction` is enabled or not. The action state will
25+
be reset if this property is toggled to `false`.
1626
code_samples: []
1727
type: boolean
1828
tags: []
@@ -28,8 +38,11 @@ properties:
2838
capabilities: []
2939
writeCapabilities: []
3040
- name: InputAction.Type
31-
summary: ''
32-
description: ''
41+
summary: |
42+
Specifies what type of input value the action is expecting.
43+
description: |
44+
Specifies what type of input value the action is expecting. See
45+
`Enum.InputActionType` for more details.
3346
code_samples: []
3447
type: InputActionType
3548
tags: []
@@ -46,14 +59,36 @@ properties:
4659
writeCapabilities: []
4760
methods:
4861
- name: InputAction:Fire
49-
summary: ''
50-
description: ''
62+
summary: |
63+
Updates the `InputAction` to the given state and fires the appropriate
64+
signals.
65+
description: |
66+
Updates the `InputAction` to the given state and fires the appropriate
67+
signals. This method is most useful for script‑triggered "input" where the
68+
passed `state` should trigger events like
69+
`Class.InputAction.Pressed|Pressed` or
70+
`Class.InputAction.StateChanged|StateChanged` regardless of whether the
71+
player triggered that state through normal inputs.
72+
73+
This method will only accept a `state` parameter that matches the
74+
`Class.InputAction.Type|Type` and attempting to call it with a mismatched
75+
type will cause an error, for example passing a state of `0.5` when the
76+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Bool`.
77+
78+
Note that this method follows the conditions of
79+
`Class.InputAction.Pressed|Pressed`,
80+
`Class.InputAction.Released|Released`, and
81+
`Class.InputAction.StateChanged|StateChanged`. For example, if you make
82+
multiple consecutive calls to `Fire()` with a state of `true`,
83+
`Class.InputAction.StateChanged|StateChanged` will only fire on the first
84+
state change and the subsequent calls to `Fire()` will do nothing.
5185
code_samples: []
5286
parameters:
5387
- name: value
5488
type: Variant
5589
default: ''
56-
summary: ''
90+
summary: |
91+
Value to which to update the `InputAction`.
5792
returns:
5893
- type: ()
5994
summary: ''
@@ -64,13 +99,18 @@ methods:
6499
capabilities: []
65100
writeCapabilities: []
66101
- name: InputAction:GetState
67-
summary: ''
68-
description: ''
102+
summary: |
103+
Returns the current state of the `Class.InputAction`.
104+
description: |
105+
Returns the current state of the `Class.InputAction`, for example `true`
106+
for an action with `Class.InputAction.Type|Type` set to
107+
`Enum.InputActionType|Bool`.
69108
code_samples: []
70109
parameters: []
71110
returns:
72111
- type: Variant
73-
summary: ''
112+
summary: |
113+
The current state of `Class.InputAction`.
74114
tags: []
75115
deprecation_message: ''
76116
security: None
@@ -79,8 +119,13 @@ methods:
79119
writeCapabilities: []
80120
events:
81121
- name: InputAction.Pressed
82-
summary: ''
83-
description: ''
122+
summary: |
123+
Fires only when the `Class.InputAction.Type` is set to
124+
`Enum.InputActionType|Bool` on a state transition from `false` to `true`.
125+
description: |
126+
This event fires only when the `Class.InputAction.Type|Type` is set to
127+
`Enum.InputActionType|Bool`, and only when the state transitions from
128+
`false` to `true`.
84129
code_samples: []
85130
parameters: []
86131
tags: []
@@ -89,8 +134,13 @@ events:
89134
capabilities: []
90135
writeCapabilities: []
91136
- name: InputAction.Released
92-
summary: ''
93-
description: ''
137+
summary: |
138+
Fires only when the `Class.InputAction.Type` is set to
139+
`Enum.InputActionType|Bool` on a state transition from `true` to `false`.
140+
description: |
141+
This event fires only when the `Class.InputAction.Type|Type` is set to
142+
`Enum.InputActionType|Bool`, and only when the state transitions from
143+
`true` to `false`.
94144
code_samples: []
95145
parameters: []
96146
tags: []
@@ -99,14 +149,19 @@ events:
99149
capabilities: []
100150
writeCapabilities: []
101151
- name: InputAction.StateChanged
102-
summary: ''
103-
description: ''
152+
summary: |
153+
Fires for all `Enum.InputActionType` types whenever the state changes,
154+
except if the state attempts to transition to the same state.
155+
description: |
156+
This event fires for all `Enum.InputActionType` types whenever the state
157+
changes, except if the state attempts to transition to the same state.
104158
code_samples: []
105159
parameters:
106160
- name: value
107161
type: Variant
108162
default: ''
109-
summary: ''
163+
summary: |
164+
The new state of the `Class.InputAction`.
110165
tags: []
111166
deprecation_message: ''
112167
security: None

content/en-us/reference/engine/classes/InputBinding.yaml

Lines changed: 108 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
name: InputBinding
22
type: class
33
memory_category: Instances
4-
summary: ''
5-
description: ''
4+
summary: |
5+
Defines which hardware binding should trigger the parent `Class.InputAction`.
6+
description: |
7+
An `InputBinding` defines which hardware binding should trigger the parent
8+
`Class.InputAction`, for example a key press, gamepad button, or tap on a
9+
touch‑enabled device. There can be multiple `InputBinding` instances parented
10+
to an `Class.InputAction`.
611
code_samples: []
712
inherits:
813
- Instance
@@ -11,8 +16,19 @@ tags:
1116
deprecation_message: ''
1217
properties:
1318
- name: InputBinding.Down
14-
summary: ''
15-
description: ''
19+
summary: |
20+
Specifies an alternate `Enum.KeyCode` for dispatching directionally "down"
21+
inputs to the parent `Class.InputAction`.
22+
description: |
23+
Specifies an alternate `Enum.KeyCode` for dispatching directionally "down"
24+
inputs to `Class.InputAction:GetState()|GetState()` and the
25+
`Class.InputAction.StateChanged|StateChanged` event of the parent
26+
`Class.InputAction`. When the parent action's
27+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Direction1D`, the
28+
dispatched value will be between `0` and `-1`. When the parent action's
29+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Direction2D`, the
30+
dispatched value will be a `Datatype.Vector2` between `(0, 0)` and `(0,
31+
-1)`.
1632
code_samples: []
1733
type: KeyCode
1834
tags: []
@@ -28,8 +44,18 @@ properties:
2844
capabilities: []
2945
writeCapabilities: []
3046
- name: InputBinding.KeyCode
31-
summary: ''
32-
description: ''
47+
summary: |
48+
Specifies the `Enum.KeyCode` which triggers the parent
49+
`Class.InputAction`.
50+
description: |
51+
Specifies the `Enum.KeyCode` which triggers the parent
52+
`Class.InputAction`. The code type should match the input action's
53+
`Class.InputAction.Type|Type`, for example `Enum.KeyCode.E` for an action
54+
type of `Enum.InputActionType|Bool` or `Enum.KeyCode.Thumbstick1` for an
55+
action type of `Enum.InputActionType|Direction2D`. Type mismatches will
56+
either not fire the `Class.InputAction` or the
57+
`Class.InputAction.StateChanged|StateChanged` event will receive a
58+
converted value.
3359
code_samples: []
3460
type: KeyCode
3561
tags: []
@@ -45,8 +71,17 @@ properties:
4571
capabilities: []
4672
writeCapabilities: []
4773
- name: InputBinding.Left
48-
summary: ''
49-
description: ''
74+
summary: |
75+
Specifies an alternate `Enum.KeyCode` for dispatching directionally "left"
76+
inputs to the parent `Class.InputAction`.
77+
description: |
78+
Specifies an alternate `Enum.KeyCode` for dispatching directionally "left"
79+
inputs to `Class.InputAction:GetState()|GetState()` and the
80+
`Class.InputAction.StateChanged|StateChanged` event of the parent
81+
`Class.InputAction`. Only applies when the parent action's
82+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Direction2D`, in
83+
which case the dispatched value will be a `Datatype.Vector2` between `(0,
84+
0)` and `(-1, 0)`.
5085
code_samples: []
5186
type: KeyCode
5287
tags: []
@@ -62,8 +97,18 @@ properties:
6297
capabilities: []
6398
writeCapabilities: []
6499
- name: InputBinding.PressedThreshold
65-
summary: ''
66-
description: ''
100+
summary: |
101+
Numerical value above which to fire an `Class.InputAction` with a
102+
`Class.InputAction.Type|Type` of `Enum.InputActionType|Bool`.
103+
description: |
104+
Numerical value above which to fire an `Class.InputAction` with a
105+
`Class.InputAction.Type|Type` of `Enum.InputActionType|Bool`, for
106+
example when a gamepad trigger such as `Enum.KeyCode.ButtonL2` exceeds
107+
`0.5` (halfway pressed). Default is `0.5`.
108+
109+
This property must be greater than or equal to
110+
`Class.InputBinding.ReleasedThreshold|ReleasedThreshold` or else it will
111+
be clamped to `Class.InputBinding.ReleasedThreshold|ReleasedThreshold`.
67112
code_samples: []
68113
type: float
69114
tags: []
@@ -79,8 +124,18 @@ properties:
79124
capabilities: []
80125
writeCapabilities: []
81126
- name: InputBinding.ReleasedThreshold
82-
summary: ''
83-
description: ''
127+
summary: |
128+
Numerical value below which to fire an `Class.InputAction` with a
129+
`Class.InputAction.Type|Type` of `Enum.InputActionType|Bool`.
130+
description: |
131+
Numerical value below which to fire an `Class.InputAction` with a
132+
`Class.InputAction.Type|Type` of `Enum.InputActionType|Bool`, for
133+
example when a gamepad trigger such as `Enum.KeyCode.ButtonL2` falls below
134+
`0.5` (less than halfway pressed). Default is `0.2`.
135+
136+
This property must be less than or equal to
137+
`Class.InputBinding.PressedThreshold|PressedThreshold` or else it will be
138+
clamped to `Class.InputBinding.PressedThreshold|PressedThreshold`.
84139
code_samples: []
85140
type: float
86141
tags: []
@@ -96,8 +151,17 @@ properties:
96151
capabilities: []
97152
writeCapabilities: []
98153
- name: InputBinding.Right
99-
summary: ''
100-
description: ''
154+
summary: |
155+
Specifies an alternate `Enum.KeyCode` for dispatching directionally
156+
"right" inputs to the parent `Class.InputAction`.
157+
description: |
158+
Specifies an alternate `Enum.KeyCode` for dispatching directionally
159+
"right" inputs to `Class.InputAction:GetState()|GetState()` and the
160+
`Class.InputAction.StateChanged|StateChanged` event of the parent
161+
`Class.InputAction`. Only applies when the parent action's
162+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Direction2D`, in
163+
which case the dispatched value will be a `Datatype.Vector2` between `(0,
164+
0)` and `(1, 0)`.
101165
code_samples: []
102166
type: KeyCode
103167
tags: []
@@ -113,8 +177,13 @@ properties:
113177
capabilities: []
114178
writeCapabilities: []
115179
- name: InputBinding.Scale
116-
summary: ''
117-
description: ''
180+
summary: |
181+
Amount by which to linearly scale the values of a directional
182+
`Class.InputAction`.
183+
description: |
184+
Amount by which to linearly scale the values of an `Class.InputAction`
185+
with `Class.InputAction.Type|Type` of `Enum.InputActionType|Direction1D`
186+
or `Enum.InputActionType|Direction2D`.
118187
code_samples: []
119188
type: float
120189
tags: []
@@ -130,8 +199,10 @@ properties:
130199
capabilities: []
131200
writeCapabilities: []
132201
- name: InputBinding.UIButton
133-
summary: ''
134-
description: ''
202+
summary: |
203+
Connects a `Class.GuiButton` to a boolean action.
204+
description: |
205+
`Class.GuiButton` to connect to a boolean action.
135206
code_samples: []
136207
type: GuiButton
137208
tags: []
@@ -147,8 +218,19 @@ properties:
147218
capabilities: []
148219
writeCapabilities: []
149220
- name: InputBinding.Up
150-
summary: ''
151-
description: ''
221+
summary: |
222+
Specifies an alternate `Enum.KeyCode` for dispatching directionally "up"
223+
inputs to the parent `Class.InputAction`.
224+
description: |
225+
Specifies an alternate `Enum.KeyCode` for dispatching directionally "up"
226+
inputs to `Class.InputAction:GetState()|GetState()` and the
227+
`Class.InputAction.StateChanged|StateChanged` event of the parent
228+
`Class.InputAction`. When the parent action's
229+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Direction1D`, the
230+
dispatched value will be between `0` and `1`. When the parent action's
231+
`Class.InputAction.Type|Type` is `Enum.InputActionType|Direction2D`, the
232+
dispatched value will be a `Datatype.Vector2` between `(0, 0)` and `(0,
233+
1)`.
152234
code_samples: []
153235
type: KeyCode
154236
tags: []
@@ -164,8 +246,12 @@ properties:
164246
capabilities: []
165247
writeCapabilities: []
166248
- name: InputBinding.Vector2Scale
167-
summary: ''
168-
description: ''
249+
summary: |
250+
Amount by which to linearly scale the values of a two-directional
251+
`Class.InputAction`.
252+
description: |
253+
Amount by which to linearly scale the values of an `Class.InputAction`
254+
with `Class.InputAction.Type|Type` of `Enum.InputActionType|Direction2D`.
169255
code_samples: []
170256
type: Vector2
171257
tags: []

0 commit comments

Comments
 (0)