Vertex Viewer SDK
    Preparing search index...

    Class WalkModeController

    Index

    Constructors

    Methods

    • Adds a custom keybinding for a specific walk operation. This will append to the existing set of keybindings to allow for multiple keybindings for a specific operation. To replace the defaults, see replaceKeyBinding.

      Parameters

      • operation: ViewerWalkModeOperation
      • ...keys: string[]

      Returns void

    • Adds an exclusion for specific elements when responding to keyboard events. This is useful when there are other elements on screen that require keyboard interaction and the walk mode handlers should not respond to the keyboard events. Can be either a element's tagName or a predicate. Returns a Disposable that can be used to remove the exclusion.

      Default tagName exclusions: 'VERTEX-SCENE-TREE' 'VERTEX-SCENE-TREE-SEARCH' 'VERTEX-VIEWER-PIN-TOOL' 'INPUT' 'TEXTAREA'

      Parameters

      • predicate: (el: Element) => boolean

      Returns Disposable

    • Adds an exclusion for specific elements when responding to keyboard events. This is useful when there are other elements on screen that require keyboard interaction and the walk mode handlers should not respond to the keyboard events. Can be either a element's tagName or a predicate. Returns a Disposable that can be used to remove the exclusion.

      Default tagName exclusions: 'VERTEX-SCENE-TREE' 'VERTEX-SCENE-TREE-SEARCH' 'VERTEX-VIEWER-PIN-TOOL' 'INPUT' 'TEXTAREA'

      Parameters

      • tagName: string

      Returns Disposable

    • Adds a custom keybinding for a specific walk operation. This will replace any existing keybindings to allow for overriding the default behavior.

      Parameters

      • operation: ViewerWalkModeOperation
      • ...keys: string[]

      Returns void

      const walkModeTool = document.querySelector('vertex-viewer-walk-mode-tool');

      // Remove keybinding for the `PIVOT_UP` operation
      walkModeTool.controller.replaceKeyBinding('PIVOT_UP');

      // Replace keybinding for `WALK_FORWARD` with `ArrowUp` instead of `w`
      walkModeTool.controller.replaceKeyBinding('WALK_FORWARD', 'ArrowUp');
    • Sets whether downstream walk mode interaction handlers are enabled. Setting this value to false will remove all event listeners for the interactions, and setting this value to true will add or re-add the event listeners.

      Parameters

      • enabled: boolean

      Returns void

    • Updates the configuration for downstream walk mode interaction handlers.

      teleportHeightPercentage - percentage used for fine-tuning the distance to offset the camera from a surface when performing a teleport-and-align. This percentage is used alongside the shortest side of the visible bounding box to determine how far to place the camera from the surface that has been hit, with a larger percentage placing the camera further from the surface and vice-versa. Defaults to 11.75%.

      teleportDistancePercentage - percentage used for fine-tuning the distance moved per click with the teleport-toward mode. This percentage is used alongside the longest side of the visible bounding box to determine how far to move the camera's position with each click, with a larger percentage moving the camera further and vice-versa. Defaults to 2%.

      teleportCollisionDistance - distance used alongside the teleportCollisionPercentage to determine whether a click with the teleport-toward mode would cause a "collision", or would pass through the point clicked. If such a collision would occur, the camera is instead placed this distance back from the point clicked once, then allowed to pass through the point on subsequent clicks. Note that this will not apply if clicks occur in quick succession without setting the depthBuffers property on the <vertex-viewer> to all frames. Defaults to 1000.

      keyboardWalkSpeed - speed to move the camera when performing keyboard-based walk interactions. A larger number here will result in a faster walk speed through the model and vice-versa. Defaults to 5.

      keyboardPivotDegrees - number of degrees to move the camera when performing keyboard-based pivot interactions. Defaults to 1.

      keyboardRepeatIntervalMs - number of milliseconds to repeat keyboard-based interactions. this value is multiplicative with the keyboardWalkSpeed and keyboardPivotDegrees, and lower numbers will result in faster movement and vice-versa. Defaults to 25.

      Parameters

      • configuration: Partial<ViewerWalkModeConfiguration>

      Returns void