Any kind of VR locomotion examples? Hand based?

Loving this! Just installed today on Unity6 and been having a blast. I was wondering if anyone has come up with any kind of hand based gesture or teleport to move through a space yet.

Hello Nynex!

It sounds like you’re diving right into VR with Needle Engine! For locomotion, you can implement hand-based gesture or teleportation features using the XRControllerMovement component. Here are key points and examples for what you’re looking for:

  1. Teleportation:

    • The XRControllerMovement component allows teleportation via gestures like pinching. You can enable this feature with properties such as useTeleport and usePinchToTeleport.
    • It uses raycasting to determine where the user can teleport based on where they are pointing with the controller.
  2. Gesture Control:

    • You can detect specific gestures (like pinch) using input from the XR controllers. This allows you to create custom locomotion methods or enhance teleportation using hand movements.
  3. Movement:

    • Basic forward/backward movement can also be controlled using thumbsticks, while rotations can be managed with joystick inputs.

Here’s a sample code excerpt for implementing teleportation and gesture recognition using XRControllerMovement:

import { XRControllerMovement } from "@needle-tools/engine";

const controllerMovement = new XRControllerMovement();
controllerMovement.useTeleport = true; // Enable teleportation
controllerMovement.usePinchToTeleport = true; // Pinch gesture to teleport
controllerMovement.movementSpeed = 1.5; // Set movement speed

const handleTeleport = (controller) => {
    const teleportInput = controller.getGesture("pinch")?.value;
    if (teleportInput > 0.8) {
        // Trigger teleportation logic here
    }
};

// Assign the function to handle teleportation on update
controllerMovement.onUpdateXR = (args) => {
    const rightController = args.xr.rightController;
    if (rightController) {
        handleTeleport(rightController);
    }
};

This sets basic teleportation and demonstrates how to use gesture control. Make sure to review your component settings within Unity to ensure everything is configured correctly.

For more examples and detailed functionality, explore the Needle Engine samples available here: Needle Engine Samples.

If you have more specific needs or configurations, feel free to ask!

1 replies left - Get a PRO license for more AI replies.
thread_Lo2fDxV1sP2DwPUfEyzVX9FK
Reply to this message to continue the conversation

Hello,

the XRControllerMovement component (it’s added by default to the scene when you use the WebXR component and didnt enable XR movement) uses the pinch teleport gesture on your right hand.

To perform the gesture flip your right hand upside down and then pinch.