The WebXR enumerated type XRHandedness provides values which identify which of a user's hands is being used to operate a particular input controller attached to the XR input device being used. XRHandedness is used as the value of the the XRInputSource property handedness.


The input controller is not associated with one of the user's hands.
The input controller is being held in, worn on, or is attached to the user's left hand.
The input controller is being held in, worn on, or is attached to the user's right hand.


One important usage scentario for handedness is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space.

function updateInputSources(session, frame, refSpace) {
  for (let source of session.inputSources) {
    if (source.gripSpace) {
      let gripPose = frame.getPose(source.gripSpace, refSpace);

      if (gripPose) {
        myRenderHandObject(gripPose, inputSource.handedness);

This function, which would be called every animation frame (or possibly just periodically, depending on the degree of smoothness required and any performance constraints), scans the list of input sources looking for any which have a gripSpace which isn't null. If a gripSpace is present, that means the input source is a hand-held device of some sort, so it should be rendered visibly if possible.

If gripSpace is non-null, the function proceeds to get the pose for the gripSpace transformed into the current reference space. Assuming that's then valid, a function called myRenderHandObject() is called with the grip's pose and the value of handedness. WIth these values in hand (no pun intended), myRenderHandObject() can draw the appropriate model positioned and formed for the correct hand.


Specification Status Comment
WebXR Device API
The definition of 'XRHandedness' in that specification.
Working Draft Initial definition.

Browser compatibility

No compatibility data found. Please contribute data for "api.XRHandedness" (depth: 1) to the MDN compatibility data repository.

See also