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:
-
Teleportation:
- The
XRControllerMovement
component allows teleportation via gestures like pinching. You can enable this feature with properties such asuseTeleport
andusePinchToTeleport
. - It uses raycasting to determine where the user can teleport based on where they are pointing with the controller.
- The
-
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.
-
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