From e7935f3066921323c2f816ce6ffa02dd8d93aee7 Mon Sep 17 00:00:00 2001 From: Nicolas Earnshaw Date: Tue, 26 Nov 2024 18:25:10 -0300 Subject: [PATCH] input modifier helper (#464) --- .../sdk7/interactivity/input-modifiers.md | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/content/creator/sdk7/interactivity/input-modifiers.md b/content/creator/sdk7/interactivity/input-modifiers.md index fa12e74f..dfafc7f4 100644 --- a/content/creator/sdk7/interactivity/input-modifiers.md +++ b/content/creator/sdk7/interactivity/input-modifiers.md @@ -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, + }), }) ``` @@ -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: {