Skip to content

Commit 26e2e4c

Browse files
update Open Source Docs from Roblox internal teams
1 parent 62419dc commit 26e2e4c

File tree

17 files changed

+939
-2101
lines changed

17 files changed

+939
-2101
lines changed

content/common/navigation/engine/guides.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ navigation:
356356
path: /ui/on-screen-containers
357357
- title: In-experience UI
358358
path: /ui/in-experience-containers
359+
- title: Accessibility guidelines
360+
path: /production/publishing/accessibility
359361
- title: UI objects
360362
section:
361363
- title: Labels

content/common/navigation/scale/design.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ navigation:
2222
path: /production/game-design/introduction-to-quest-design
2323
- title: UI and UX
2424
path: /production/game-design/ui-ux-design
25-
- title: Device guidelines
26-
section:
27-
- title: Accessibility
28-
path: /production/publishing/accessibility
29-
- title: Console
30-
path: /production/publishing/console-guidelines
31-
- title: VR
32-
path: /production/publishing/vr-guidelines
25+
- title: Console guidelines
26+
path: /production/publishing/console-guidelines
27+
- title: VR guidelines
28+
path: /production/publishing/vr-guidelines
3329
- heading: Monetize your experience
3430
- title: Monetization
3531
path: /production/game-design/monetization-foundations

content/en-us/art/validation-errors.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,15 @@ See the following resources for caging:
291291
<td>Missing HSR data for `%s`. Please, try again.</td>
292292
<td>The HSR (Hidden Surface Removal) data is calculated in the cloud server and may take a few minutes to be updated for your assets. Wait some time and try again.</td>
293293
</tr>
294+
<tr>
295+
<td>Failed to execute body max cage distance check. Make sure all render meshes and their WrapTarget cage meshes exist, and try again.</td>
296+
<td></td>
297+
</tr>
298+
<tr id = "bodyCageMaxSize">
299+
<td>A vertex was found on the `%s`'s cage mesh that is `%.2f` studs away from the closest render mesh. `%s` studs is the maximum. Make the cage mesh more closely match the shape and size of the render mesh.</td>
300+
<td></td>
301+
</tr>
302+
294303
</tbody>
295304
</table>
296305

@@ -475,7 +484,7 @@ See the following for more information on various character body components:
475484
</tr>
476485
<tr>
477486
<td>Attachment `%s` in `%s` is placed at a position `%s` that is outside the valid range. You need to adjust the attachment position.<br/><br/>Attachment `%s` in `%s` is placed at a position `%s` that is outside the valid range of (`%s` to `%s`). You need to adjust the attachment position.</td>
478-
<td>Body attachments need to be within reasonable distance from the body][should not have an applied rotation](../art/characters/specifications.md#attachments) to avoid introducing unrealistic gaps when equipping accessories to those attachments.</td>
487+
<td>Body attachments need to be within reasonable distance from the body[should not have an applied rotation](../art/characters/specifications.md#attachments) to avoid introducing unrealistic gaps when equipping accessories to those attachments.</td>
479488
</tr>
480489
<tr>
481490
<td>Body part `%s` does not follow R15 schema. The specific issues are: `%s`</td>

content/en-us/input/gamepad.md

Lines changed: 18 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import BetaAlert from '../includes/beta-features/beta-alert.md'
88

99
Roblox accepts input from USB gamepads such as Xbox and PlayStation controllers. Since gamepads come in different varieties, you need to follow additional setup to verify that a player's gamepad inputs are usable in your experience.
1010

11-
To set up gamepad inputs, you can use `Class.ContextActionService` or `Class.UserInputService` to [detect connected gamepads](#detect-gamepads) for a player's device, [verify supported inputs](#verify-supported-inputs) that are compatible with Roblox, [receive input](#receive-input), and more.
11+
To set up gamepad inputs, you can use `Class.UserInputService` to [detect connected gamepads](#detect-gamepads) for a player's device, [verify supported inputs](#verify-supported-inputs) that are compatible with Roblox, [receive input](#receive-input), and more.
1212

1313
When binding gamepad inputs, see [common control schemas](#common-control-schemas) to create a consistent gamepad experience for players. After inputs are set, you can enhance the player's experience by including [haptic feedback](#haptic-feedback) on supported controllers.
1414

@@ -67,25 +67,7 @@ end
6767

6868
## Receive input
6969

70-
`Class.ContextActionService` is useful for binding controls to both gamepads and other input sources such as [mouse and keyboard](./mouse-and-keyboard.md) inputs or [mobile](../input/mobile.md) touchscreen buttons, or for binding multiple functions to a single button input on any device. For example, the following code sample binds an `OpenSpellBook` action to the gamepad's `Enum.KeyCode.ButtonR2|ButtonR2` button and the keyboard's `Enum.KeyCode.B|B` key.
71-
72-
```lua title="ContextActionService Bind Action"
73-
local ContextActionService = game:GetService("ContextActionService")
74-
75-
local function openSpellBook(actionName, inputState, inputObject)
76-
if inputState == Enum.UserInputState.Begin then
77-
-- Open spell book
78-
end
79-
end
80-
81-
ContextActionService:BindAction("OpenSpellBook", openSpellBook, false, Enum.KeyCode.ButtonR2, Enum.KeyCode.B)
82-
```
83-
84-
<Alert severity="info">
85-
Functions bound to `Class.ContextActionService` will fire on all input states (`Enum.UserInputState|Begin`, `Enum.UserInputState|Change`, and `Enum.UserInputState|End`), so it's recommended that you check the `Class.InputObject.UserInputState|UserInputState` as seen on line 4 to ensure the desired action only happens on the gamepad input state you intend it to.
86-
</Alert>
87-
88-
Alternatively, you can use `Class.UserInputService` to bind controls directly from a gamepad. When detecting gamepad events through this service, use the `Class.UserInputService.InputBegan|InputBegan` event to detect when the button was initially pressed and `Class.UserInputService.InputEnded|InputEnded` to detect when the button is released. In the handling function, the `Class.InputObject.UserInputType` property indicates which gamepad fired the event and `Class.InputObject.KeyCode` indicates the specific button or stick that fired it.
70+
You can use `Class.UserInputService` to bind controls directly from a gamepad. When detecting gamepad events through this service, use the `Class.UserInputService.InputBegan|InputBegan` event to detect when the button was initially pressed and `Class.UserInputService.InputEnded|InputEnded` to detect when the button is released. In the handling function, the `Class.InputObject.UserInputType` property indicates which gamepad fired the event and `Class.InputObject.KeyCode` indicates the specific button or stick that fired it.
8971

9072
```lua title="UserInputService Button Press Detection"
9173
local UserInputService = game:GetService("UserInputService")
@@ -194,88 +176,29 @@ The following are common input binds that will help players immediately feel fam
194176

195177
## Haptic feedback
196178

197-
Many gamepad controllers have motors built in to provide haptic feedback. Adding rumbles and vibrations can greatly enhance a player's experience and provide subtle feedback beyond visuals or audio. You can use the `Class.HapticService` to [verify vibration support](#vibration-support) before [turning on the motors](#activate-motors).
179+
Many gamepad controllers have motors built in to provide haptic feedback. Adding rumbles and vibrations can greatly enhance a player's experience and provide subtle feedback beyond visuals or audio.
198180

199-
### Vibration support
181+
Roblox supports haptics for the following devices:
200182

201-
Not all controllers have motors so it is important to check for support before attempting to use the haptic motors. To query if a given controller has vibration support, call `Class.HapticService:IsVibrationSupported()`.
183+
- Android and iOS phones supporting haptics including most iPhone, Pixel, and
184+
Samsung Galaxy devices
185+
- PlayStation gamepads
186+
- Xbox gamepads
187+
- Quest Touch controller
202188

203-
```lua title="Check Vibration Support"
204-
local HapticService = game:GetService("HapticService")
189+
Haptic feedback is managed through `Class.HapticEffect` instances which can be set to a specific `Class.HapticEffect.Type|Type` such as `Enum.HapticEffectType|GameplayCollision` or `Enum.HapticEffectType|UIClick`.
205190

206-
local gamepad = Enum.UserInputType.Gamepad1
207-
local isVibrationSupported = HapticService:IsVibrationSupported(gamepad)
208-
```
191+
Once a `Class.HapticEffect` is in place, you can initiate it through the `Class.HapticEffect:Play()|Play()` method, for instance:
209192

210-
Some controllers have multiple motors for various scales of vibration. Once you've checked if a gamepad supports vibration, you should also check if it supports the motors you intend to use through `Class.HapticService:IsMotorSupported()`.
193+
```lua
194+
local Workspace = game:GetService("Workspace")
211195

212-
```lua title="Check Motors Supported"
213-
local HapticService = game:GetService("HapticService")
196+
local effect = Instance.new("HapticEffect")
197+
effect.Type = Enum.HapticEffectType.GameplayExplosion
198+
effect.Parent = Workspace
214199

215-
local gamepad = Enum.UserInputType.Gamepad1
216-
local isVibrationSupported = HapticService:IsVibrationSupported(gamepad)
217-
218-
if isVibrationSupported then
219-
local largeMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.Large)
220-
local smallMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.Small)
221-
local leftTriggerMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.LeftTrigger)
222-
local rightTriggerMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.RightTrigger)
223-
local leftHandMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.LeftHand)
224-
local rightHandMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.RightHand)
225-
end
226-
```
227-
228-
<table size="small">
229-
<thead>
230-
<tr>
231-
<th>Size or Location</th>
232-
<th>Description</th>
233-
</tr>
234-
</thead>
235-
<tbody>
236-
<tr>
237-
<td>`Enum.VibrationMotor.Large|Large`</td>
238-
<td>Larger motor, useful for generic rumble.</td>
239-
</tr>
240-
<tr>
241-
<td>`Enum.VibrationMotor.Small|Small`</td>
242-
<td>Smaller motor, useful for more subtle rumbles like tires slipping, electric shock, etc.</td>
243-
</tr>
244-
<tr>
245-
<td>`Enum.VibrationMotor.LeftTrigger|LeftTrigger`</td>
246-
<td>Underneath the left trigger.</td>
247-
</tr>
248-
<tr>
249-
<td>`Enum.VibrationMotor.RightTrigger|RightTrigger`</td>
250-
<td>Underneath the right trigger.</td>
251-
</tr>
252-
<tr>
253-
<td>`Enum.VibrationMotor.LeftHand|LeftHand`</td>
254-
<td>On the left side of the controller.</td>
255-
</tr>
256-
<tr>
257-
<td>`Enum.VibrationMotor.RightHand|RightHand`</td>
258-
<td>On the right side of the controller.</td>
259-
</tr>
260-
</tbody>
261-
</table>
262-
263-
### Activate motors
264-
265-
Once you've confirmed that a player's gamepad [supports vibration](#vibration-support), you can turn on a specific motor with `Class.HapticService:SetMotor()`. This method takes the gamepad and the amplitude of the vibration as arguments. Amplitude can be any value between 0 and 1.
266-
267-
```lua title="Activating Motor"
268-
local HapticService = game:GetService("HapticService")
269-
270-
local gamepad = Enum.UserInputType.Gamepad1
271-
local isVibrationSupported = HapticService:IsVibrationSupported(gamepad)
272-
273-
if isVibrationSupported then
274-
local largeMotor = HapticService:IsMotorSupported(gamepad, Enum.VibrationMotor.Large)
275-
if largeMotor then
276-
HapticService:SetMotor(gamepad, Enum.VibrationMotor.Large, 0.5)
277-
end
278-
end
200+
-- Play the haptic effect
201+
effect:Play()
279202
```
280203

281204
## Controller emulation

0 commit comments

Comments
 (0)