Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XR] Support controller as source of forward vector #14152

Open
Corysia opened this issue Aug 11, 2023 · 1 comment
Open

[XR] Support controller as source of forward vector #14152

Corysia opened this issue Aug 11, 2023 · 1 comment

Comments

@Corysia
Copy link

Corysia commented Aug 11, 2023

As discussed here, I would like to be able to allow my users to choose a controller as the source for the forward vector for smooth locomotion. This feature is supported in many games (e.g., Skyrim VR, Stormland, etc...) and is sometimes referred to as "wand forward" vs "HMD forward" which BabylonJS already supports. The advantage to this type of movement is that you can point your hand in the direction you wish to go, and look around at your surroundings without changing your trajectory. I believe most First Person Shooters are configured this way.

It's already possible to set either your left or right controller to handle movement and the opposite to handle rotation. Typically, the controller that is handling movement would be defined as the "forward" source. In the Unity XR Interaction Toolkit, there is an option to drop in an object that is used to determine the source for Vector.Foward and Vector.Up. Doing something similar would be ideal, such as adding a field for the feature manager.

            const smoothLocomotion = featureManager.enableFeature(WebXRFeatureName.MOVEMENT, 'latest', {
                xrInput: xr.input,
                floorMeshes: [this.scene.getMeshByName('ground1')!],
                customRegistrationConfigurations: leftHandConfiguration,
                // add options here
                movementOrientationFollowsViewerPose: false,
                // new option
                movementOrientationForwardSource: leftMotionController

where leftMotionController is a WebXRInputSource. Alternatively, it could be any object that has a matrix where a Vector.Forward, Vector.Right, and Vector.Up can be determined. This could offer more flexibility, allowing for the support of the camera following a vehicle such as an airplane.

A screenshot from the Unity XR Interaction Toolkit and their "Forward Source" field:
image

@thomlucc thomlucc added this to the 7.0 milestone Aug 24, 2023
@thomlucc thomlucc modified the milestones: 7.0, Future Jan 9, 2024
@thomlucc thomlucc modified the milestones: Future, 8.0 Mar 12, 2024
Copy link

This issue has been automatically staled because it has been inactive for more than 14 days. Please update to "unstale".

@github-actions github-actions bot added the stale label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants