Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input modifier helper #464

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions content/creator/sdk7/interactivity/input-modifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ You can freeze the player so that none of the input keys can move the avatar. Th
Use the `InputModifier` component on the `engine.PlayerEntity` to prevent the player's inputs from affecting the avatar's locomotion. The avatar will remain still, the player will only be able to rotate the camera.

```ts
InputModifier.createOrReplace(engine.PlayerEntity, {
mode: {
$case: 'standard',
standard: {
disableAll: disableAll,
},
},
InputModifier.create(playerEntity, {
mode: InputModifier.Mode.Standard({
disableAll: true,
}),
})
```

Expand All @@ -47,6 +44,23 @@ Instead of entirely freezing the player, you can restrict certain specific forms
- `disableEmote`: Player can't perform emotes voluntarily. The scene is able to trigger animations on the player's avatar.
- `disableAll`: The player can't perform any of the above actions.

```ts
InputModifier.create(playerEntity, {
mode: InputModifier.Mode.Standard({
disableAll: false,
disableWalk: false,
disableRun: true,
disableJog: true,
disableJump: true,
disableEmote: true,
}),
})
```

## Advanced syntax

To use the component without any helpers, you can use the following syntax:

```ts
InputModifier.createOrReplace(engine.PlayerEntity, {
mode: {
Expand Down