Xr controller (inputSource.handedness) return empty string instead of (left/right)

Hi, please i’m trying to detect the Xr controller if it’s the right one or the left one, before assigning it to an specific entity, so i’m using this code:

this.app.xr.input.on('add', function (inputSource) {
        if(inputSource.handedness==pc.XRHAND_RIGHT){
            let entityRight = this.XrGamepadRight.clone();
            entityRight.script.jsControllerXrGamepadRight.setInputSource(inputSource);
            entityRight.reparent(this.cameraParent);
            entityRight.enabled = true;
        }
        else if(inputSource.handedness==pc.XRHAND_LEFT){
            let entityLeft = this.XrGamepadLeft.clone();
            entityLeft.script.jsControllerXrGamepadLeft.setInputSource(inputSource);
            entityLeft.reparent(this.cameraParent);
            entityLeft.enabled = true;
        }
    }, this);

but the issue is that the “inputSource.handedness” return empty string"" so is there like another way to detect whether if the controller that been added is the right one or the left one,
and thanks in advance!

What VR device are you having this problem with?

Is handedness also the empty string when testing with Immersive Web Emulator?

Have you tried out the xr-controllers.mjs script that the engine provides? That uses the handedness property and it seems to work fine (at least for Quest and Apple Vision Pro).

thanks for your response, i’m using both Quest3 and Immersive Web Emulator, this happens at the initial input “add” events, and by the way i tried the “xr-controllers.mjs” it reports an error can’t reach the json file, please check the screenshot

Yeah, you can see via the Immersive Web Emulator, the xr-controllers.mjs script with search for a suitable controller profile. If that fails, it falls back to a more and more generic one:

For hands, it proposes 4 suitable profiles:

It fails to find oculus-hand and generic-hand-select on the server. But it successfully loads generic-hand and generic-trigger though…and it used generic-hand because it’s earlier in the array (so more ‘relevant’).

aha i see, at the moment i’m more focusing on the gamepads, to give a glance about what i’m trying to do exactly, i have two gamepads 3d assets, each one represent a hand (right/left), the right hand gamepad 3d asset has be assigned to the right hand and the left hand gamepad 3d asset has be assigned to the left hand, so i’m trying to do so by listening to the Xr “add” event, and inside this event i’m checking whether the “handedness” attribute return (right or left) to assign to the correct 3d asset gamepad (left/right), but the issue is that inside the event the inputSource.handedness return empty string, so i can’t detect which one is the right handed or the left handed.