-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Question] Questions regarding ControllerData and ControllerStateType structure #41
Comments
I made a mistake, the length should be The details of these buttons can be found here: Button and Trackpad StatesThe Motion Controller API is covered by the attribute to get the button and trackpad states. The following code snippet shows how to extract the button and trackpad states from the gamepad: The returned data looks like the following: /**
* Significantly more accurate and stable than controller-tracking.
*/
export type ControllerData = {
left?: Matrix4Tuple; // array with length==16
right?: Matrix4Tuple; // array with length==16
leftState?: ControllerStateType;
rightState?: ControllerStateType;
};
export type ControllerStateType = {
trigger: boolean;
squeeze: boolean;
touchpad: boolean;
thumbstick: boolean;
aButton: boolean;
bButton: boolean;
triggerValue: number;
squeezeValue: number;
touchpadValue: [ number, number ]; // X and Y values for the touchpad
thumbstickValue: [ number, number ]; // X and Y values for the thumbstick
aButtonValue: boolean;
bButtonValue: boolean;
}; Button and Trackpad StatesThe webXR Motion Controller API uses the XRInputSource's gamepad. For detailed API, refer to the link attribute to get the button and trackpad states. The following code snippet shows how to extract the button and trackpad states from the gamepad:
const gamepad = inputSource.gamepad;
const buttons = gamepad?.buttons || [];
return {
transform: Array.from(transform) as Matrix4Tuple,
trigger: buttons[0]?.pressed || false,
squeeze: buttons[1]?.pressed || false,
touchpad: buttons[2]?.pressed || false,
thumbstick: buttons[3]?.pressed || false,
aButton: buttons[4]?.pressed || false,
bButton: buttons[5]?.pressed || false,
triggerValue: buttons[0]?.value || 0,
squeezeValue: buttons[1]?.value || 0,
touchpadValue: [gamepad?.axes[0] || 0, gamepad?.axes[1] || 0],
thumbstickValue: [gamepad?.axes[2] || 0, gamepad?.axes[3] || 0],
aButtonValue: buttons[4]?.pressed || false,
bButtonValue: buttons[5]?.pressed || false,
}; Matrix formatAll 4x4 transform matrices used in WebGL are stored in 16-element
For details, refer to the MDN documentation on XR Rigid Body Transformation |
Thank you for providing the documentation! I have successfully implemented a remote control task for the robotic arm using the API, and I truly appreciate your support. During my usage, I encountered the following issues and would like to ask for your advice on possible solutions:
Looking forward to your response, and thank you again! |
I will test out 1. This might take longer to fix. If you can share a video it will make it easier for me to decide where it came from. @AdamRashid96 do you notice this? regarding 2, I believe you are able to use the controller on one hand, and hand on another. you just cant have all four at the same time. Is this what you were looking for? |
I have experienced the issue 1 as well. There were also many times, vuer stucks in loading or the controller handle function never got called. |
Hi! I’m working with Vuer to process Quest 3 controller data, but I have a few questions that I hope you can help clarify.
Regarding left and right in ControllerData:
The left and right fields are of type Matrix4Tuple, with a length of 25. This length seems to match the number of key points in hand tracking. Could you clarify if these left and right matrices represent the hand keypoint poses just same as hand tracking?
Regarding the state fields in ControllerStateType:
What exactly do the fields trigger, squeeze, touchpad, thumbstick, aButton, and bButton represent? What are their specific functions?
Is there any documentation or detailed reference available for these fields?
Thanks in advance for your help. I look forward to your response!
The text was updated successfully, but these errors were encountered: