aframe-extras icon indicating copy to clipboard operation
aframe-extras copied to clipboard

Movement Controls do not work with left Oculus Touch controller (Quest 2)

Open radicalappdev opened this issue 4 years ago • 8 comments

When using the movement-controls component with an Oculus Quest 2, the thumbstick on the left controller does not move the rig/player. The right controller works fine, but nothing happens with the left controller. Is there a way to tell this component to use the left controller instead of (or in addition to) the right controller?

Example scene

Example scene code:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>WebXR Sandbox</title>

    <script src="https://aframe.io/releases/1.1.0/aframe.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/donmccurdy/[email protected]/dist/aframe-extras.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/aframe-environment-component.min.js">
    </script>
</head>

<body>

    <a-scene>
        <a-entity id="rig" movement-controls="fly: false;">
            <a-camera id="camera"></a-camera>
            <a-entity hand-controls="hand: right; handModelStyle: lowPoly; color: #ffcccc"></a-entity>
            <a-entity hand-controls="hand: left; handModelStyle: lowPoly; color: #ffcccc"></a-entity>
        </a-entity>

        <a-entity environment="ground: flat; grid: 1x1; skyType: gradient; skyColor: #0f107f; horizonColor: #0a0a0a">
        </a-entity>
    </a-scene>

</body>

</html>

radicalappdev avatar Jan 07 '21 15:01 radicalappdev

@donmccurdy I found some other issues where you discussed this issue and if I'm reading these correctly it appears you added a preference for preferred handedness.

I'm using the following version of aframe-extras on an Oculus Quest 2 and I'm still only able to get locomotion working on the right controller.

How do I actually tell the movement component or gamepad component that I want to use the left controller for this? I see in the other issues where you added a preference for preferred handedness but it is not clear how to use that.

radicalappdev avatar Jan 15 '21 11:01 radicalappdev

The changes in https://github.com/n5ro/aframe-extras/pull/332 should have made the selection of the left controller for movement a consistent default, but did not provide a way to change that default. Also note that if your browser doesn't support the WebXR APIs, there's nothing I'm aware of that A-Frame Extras can do to tell which controller is which, so it just has to pick one arbitrarily based on order they are provided by the Gamepad API.

donmccurdy avatar Jan 15 '21 19:01 donmccurdy

I'm using the latest version of the Oculus browser on a Quest 2. It supports the WebXR APIs. Nevertheless the right controller is always used for the movement component. Is there anything at all that can be done?

radicalappdev avatar Jan 15 '21 19:01 radicalappdev

I'm sure there, is but it would require setting up a Chrome debugger with the device and putting a breakpoint somewhere in gamepad-controls.js to figure out what the device is reporting about its gamepads. This requires a USB cable, and a bit of setup the first time. See https://developer.oculus.com/documentation/oculus-browser/browser-remote-debugging/.

donmccurdy avatar Jan 15 '21 20:01 donmccurdy

I ran into this issue with Quest 2. I believe as mentioned by @donmccurdy, the controllers are used based on the order they are detected. If your right hand is dominant, you may be activating the right controller every time you start your Quest/browser. I rebooted my quest and made sure the left controller was the first detected controller and indeed the controls were bound to the left controller. I'm not sure exactly at what point the controller order/dominance is decided, but after multiple browser restarts I didn't seem to be able to get it to change, only a reboot helped.

rossbishop avatar Apr 10 '21 21:04 rossbishop

I tried setting up the debugging environment, but I could not even get ADB installed and recognized on my machine. That entire process of setting up android tools is beyond me.

I wonder if there is a better way to think about this. Instead of attaching the movement controls to the "player/rig" object, would it be possible to attach them to a hand?

For example, if I have the following rig, attach a component to the left or right hand (based on the developer's preference), piggybacking on the hand-controls component that is available in A-Frame to determine which hand is which. This would remove the need for aframe-extras to try to determine which controller belongs in which hand. At the same time, I guess it would be dependent on using the hand-controls component...

            <a-entity id="rig">
                <a-camera id="camera"></a-camera>
                <a-entity hand-controls="hand: right; handModelStyle: lowPoly; color: #ffcccc">
                </a-entity>
                <a-entity hand-controls="hand: left; handModelStyle: lowPoly; color: #ffcccc" hand-movement-controls="fly: false;">
                </a-entity>
            </a-entity>

If that doesn't make sense, then how about adding a parameter to movement-controls that can let the developer pass the ID of the hand/controller that they want the movement controls to be attached to?

            <a-entity id="rig" movement-controls="fly: false; attachTo: #controllerHand;">
                <a-camera id="camera"></a-camera>
                <a-entity hand-controls="hand: right; handModelStyle: lowPoly; color: #ffcccc">
                </a-entity>
                <a-entity id="controllerHand" hand-controls="hand: left; handModelStyle: lowPoly; color: #ffcccc">
                </a-entity>
            </a-entity>

radicalappdev avatar Jun 01 '21 15:06 radicalappdev

I'm sure there, is but it would require setting up a Chrome debugger with the device and putting a breakpoint somewhere in gamepad-controls.js to figure out what the device is reporting about its gamepads. This requires a USB cable, and a bit of setup the first time. See https://developer.oculus.com/documentation/oculus-browser/browser-remote-debugging/.

I was unable to get debugging setup and working based on the link you provided, but Jason Johnston on twitter suggested a simpler approach to debugging.

@donmccurdy Can you be more specific about where to add a breakpoint? I added the development version of aframe-extras to the sample scene. This only has one JS file and I'm not sure where in this file to look. What values/variables should I be looking for?

radicalappdev avatar Jun 21 '21 19:06 radicalappdev

This issue has been fixed in this pull request

radicalappdev avatar Jun 25 '21 15:06 radicalappdev