You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I brought it up on the forum but then I realized it might be too specific to discuss on the forum so adding it as an issue here.
Describe the bug
WebXRController doesn't populate hand.joints when the controller i.e. hand is connected / starts getting tracked. This leads to hand.joints being {} when accessed inside controller "connected" event. hand.joints are populated only after the first WebXRController update call.
To Reproduce
Steps to reproduce the behavior:
Add an Event Listener callback for controller connected event.
Current implementation of WebXRController returns {} for hand.joints when accessed after controller connected, expected {"joint1":Group, "joint2":Group...} . An alternative for getting the joints would be to add it some update method, but it requires polling instead of being event-driven, can be considered worse from a performance perspective (see render in the Glitch example)
Screenshots
Platform:
Device: [Desktop, VR]
Browser: [Chrome, Oculus Browser]
Three.js version: [ r145]
The text was updated successfully, but these errors were encountered:
I am working on an MR for resolving this issue. The idea is to populate hand.joints while dispatching the connected event instead of waiting for the next update. Main changes in WebXRController.js include:
getHandJoint(hand,inputjoint){if(hand.joints[inputjoint.jointName]===undefined){// The transform of this joint will be updated with the joint pose on each frameconstjoint=newGroup();joint.matrixAutoUpdate=false;joint.visible=false;hand.joints[inputjoint.jointName]=joint;hand.add(joint);}returnhand.joints[inputjoint.jointName];}connect(inputSource){if(inputSource&&inputSource.hand){consthand=this._hand;if(hand){for(constinputjointofinputSource.hand.values()){this.getHandJoint(hand,inputjoint);}}}this.dispatchEvent({type: 'connected',data: inputSource});returnthis;}
I have added the build after the changes from the MR in the same Glitch example, you can try it out by commenting out the latest release and uncommenting the new build. The MR tries to fix this issue without adding any extra loops or calls in the controller update
I brought it up on the forum but then I realized it might be too specific to discuss on the forum so adding it as an issue here.
Describe the bug
WebXRController doesn't populate
hand.joints
when the controller i.e. hand is connected / starts getting tracked. This leads tohand.joints
being{}
when accessed inside controller "connected" event.hand.joints
are populated only after the first WebXRControllerupdate
call.To Reproduce
Steps to reproduce the behavior:
connected
event.hand.joints
is{}
inside the callback.Code
Live example
Also see comment notes inside the Glitch example above
Expected behavior
Current implementation of WebXRController returns {} for
hand.joints
when accessed after controller connected, expected{"joint1":Group, "joint2":Group...}
. An alternative for getting the joints would be to add it someupdate
method, but it requires polling instead of being event-driven, can be considered worse from a performance perspective (seerender
in the Glitch example)Screenshots
Platform:
The text was updated successfully, but these errors were encountered: