useXRControllerLocomotion

useXRControllerLocomotion(target, translationOptions, rotationOptions, translationControllerHand): void

A hook for handling basic locomotion in VR

Parameters

target

Either a THREE.Group ref, or a callback function. Recieves movement input (required).

RefObject<null | Object3D<Object3DEventMap>> | (velocity, rotationVelocityY, deltaTime, state, frame?) => void

translationOptions

XRControllerLocomotionTranslationOptions = {}

Options that control the translation of the user. Set to false to disable.

translationOptions.speed

The speed at which the user moves.

rotationOptions

XRControllerLocomotionRotationOptions = {}

Options that control the rotation of the user. Set to false to disable.

rotationOptions.deadZone

How far the joystick must be pushed to trigger a turn.

rotationOptions.type

Controls how rotation using the controller functions. Can be either 'smooth' or 'snap'.

rotationOptions.degrees

If type is 'snap', this specifies the number of degrees to snap the user's view by.

rotationOptions.speed

If type is 'smooth', this specifies the speed at which the user's view rotates.

translationControllerHand

Specifies which hand will control the movement. Can be either 'left' or 'right'.

"left" | "right"

Returns


void