Firefox Tomorrow

web api interface

XRHand

View on MDN ↗

The XRHand interface is pair iterator (an ordered map) with the key being the hand joints and the value being an XRJointSpace.

XRHand is returned by hand.

Instance properties

  • size Read only Experimental
    • : Returns 25, the size of the pair iterator.

Instance methods

The XRHand object is a pair iterator. It can directly be used in a for...of structure. for (const joint of myHand) is equivalent to for (const joint of myHand.entries()). However, it’s not a map-like object, so you don’t have the clear(), delete(), has(), and set() methods.

  • entries() Experimental
    • : Returns an iterator with the hand joints/XRJointSpace pairs for each element. See entries() for more details.
  • forEach() Experimental
  • get() Experimental
    • : Returns a XRJointSpace for a given hand joint or undefined if no such hand joint key is in the map. See get() for more details.
  • keys() Experimental
    • : Returns an iterator with all the hand joint keys. See keys() for more details.
  • values() Experimental

Hand joints

The XRHand object contains the following hand joints:

Hand

Hand jointIndex
wrist0
thumb-metacarpal1
thumb-phalanx-proximal2
thumb-phalanx-distal3
thumb-tip4
index-finger-metacarpal5
index-finger-phalanx-proximal6
index-finger-phalanx-intermediate7
index-finger-phalanx-distal8
index-finger-tip9
middle-finger-metacarpal10
middle-finger-phalanx-proximal11
middle-finger-phalanx-intermediate12
middle-finger-phalanx-distal13
middle-finger-tip14
ring-finger-metacarpal15
ring-finger-phalanx-proximal16
ring-finger-phalanx-intermediate17
ring-finger-phalanx-distal18
ring-finger-tip19
pinky-finger-metacarpal20
pinky-finger-phalanx-proximal21
pinky-finger-phalanx-intermediate22
pinky-finger-phalanx-distal23
pinky-finger-tip24

Examples

Using XRHand objects

const wristJoint = inputSource.hand.get("wrist");
const indexFingerTipJoint = inputSource.hand.get("index-finger-tip");

for (const [joint, jointSpace] of inputSource.hand) {
  console.log(joint);
  console.log(jointSpace);
}

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also