Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. XRHand

XRHand

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

TheXRHand interface is pair iterator (an ordered map) with the key being the hand joints and the value being anXRJointSpace.

XRHand is returned byXRInputSource.hand.

Instance properties

sizeRead onlyExperimental

Returns25, the size of the pair iterator.

Instance methods

TheXRHand object is a pair iterator. It can directly be used in afor...of structure.for (const joint of myHand) is equivalent tofor (const joint of myHand.entries()).However, it's not a map-like object, so you don't have theclear(),delete(),has(), andset() methods.

entries()Experimental

Returns an iterator with the hand joints/XRJointSpace pairs for each element.SeeMap.prototype.entries() for more details.

forEach()Experimental

Runs a provided function once per each hand joint/XRJointSpace pair.SeeMap.prototype.forEach() for more details.

get()Experimental

Returns aXRJointSpace for a given hand joint orundefined if no such hand joint key is in the map.SeeMap.prototype.get() for more details.

keys()Experimental

Returns an iterator with all the hand joint keys.SeeMap.prototype.keys() for more details.

values()Experimental

Returns an iterator with all theXRJointSpace values.SeeMap.prototype.values() for more details.

Hand joints

TheXRHand 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

UsingXRHand objects

js
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

Specification
WebXR Hand Input Module - Level 1
# xrhand-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp