Skip to content

Commit

Permalink
input modifier helper (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
nearnshaw authored Nov 26, 2024
1 parent da6b002 commit e7935f3
Showing 1 changed file with 21 additions and 7 deletions.
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

0 comments on commit e7935f3

Please sign in to comment.