XRHandModelFactory.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>XRHandModelFactory - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">XRHandModelFactory</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Similar to <a href="XRControllerModelFactory.html">XRControllerModelFactory</a>, this class allows to create hand models
  16. for WebXR controllers that can be added as a visual representation to your scene.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const handModelFactory = new XRHandModelFactory();
  19. const hand = renderer.xr.getHand( 0 );
  20. hand.add( handModelFactory.createHandModel( hand ) );
  21. scene.add( hand );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <h2 class="subsection-title">Import</h2>
  26. <p><span translate="no">XRHandModelFactory</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  27. <pre><code class="language-js">import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js';</code></pre>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="XRHandModelFactory" translate="no">new <a href="#XRHandModelFactory">XRHandModelFactory</a><span class="signature">( gltfLoader : <span class="param-type">GLTFLoader</span>, onLoad : <span class="param-type">function</span> )</span> </h3>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new XR hand model factory.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name"><code>gltfLoader</code></td>
  39. <td class="description last"><p>A glTF loader that is used to load hand models.<br/>Default is <code>null</code>.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>onLoad</code></td>
  43. <td class="description last"><p>A callback that is executed when a hand model has been loaded.<br/>Default is <code>null</code>.</p></td>
  44. </tr>
  45. </tbody>
  46. </table>
  47. </div>
  48. </div>
  49. <h2 class="subsection-title">Properties</h2>
  50. <div class="member">
  51. <h3 class="name" id="gltfLoader" translate="no">.<a href="#gltfLoader">gltfLoader</a><span class="type-signature"> : <a href="GLTFLoader.html">GLTFLoader</a></span> </h3>
  52. <div class="description">
  53. <p>A glTF loader that is used to load hand models.<br/>Default is <code>null</code>.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="onLoad" translate="no">.<a href="#onLoad">onLoad</a><span class="type-signature"> : function</span> </h3>
  58. <div class="description">
  59. <p>A callback that is executed when a hand model has been loaded.<br/>Default is <code>null</code>.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="path" translate="no">.<a href="#path">path</a><span class="type-signature"> : string</span> </h3>
  64. <div class="description">
  65. <p>The path to the model repository.<br/>Default is <code>null</code>.</p>
  66. </div>
  67. </div>
  68. <h2 class="subsection-title">Methods</h2>
  69. <h3 class="name name-method" id="createHandModel" translate="no">.<a href="#createHandModel">createHandModel</a><span class="signature">( controller : <span class="param-type">Group</span>, profile : <span class="param-type">'spheres' | 'boxes' | 'mesh'</span> )</span><span class="type-signature"> : <a href="XRHandModel.html">XRHandModel</a></span> </h3>
  70. <div class="method">
  71. <div class="description">
  72. <p>Creates a controller model for the given WebXR hand controller.</p>
  73. </div>
  74. <table class="params">
  75. <tbody>
  76. <tr>
  77. <td class="name"><code>controller</code></td>
  78. <td class="description last"><p>The hand controller.</p></td>
  79. </tr>
  80. <tr>
  81. <td class="name"><code>profile</code></td>
  82. <td class="description last"><p>The model profile that defines the model type.</p></td>
  83. </tr>
  84. </tbody>
  85. </table>
  86. <dl class="details">
  87. <dt class="tag-returns"><strong>Returns:</strong> The XR hand model.</dt>
  88. </dl>
  89. </div>
  90. <h3 class="name name-method" id="setPath" translate="no">.<a href="#setPath">setPath</a><span class="signature">( path : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="XRHandModelFactory.html">XRHandModelFactory</a></span> </h3>
  91. <div class="method">
  92. <div class="description">
  93. <p>Sets the path to the hand model repository.</p>
  94. </div>
  95. <table class="params">
  96. <tbody>
  97. <tr>
  98. <td class="name"><code>path</code></td>
  99. <td class="description last"><p>The path to set.</p></td>
  100. </tr>
  101. </tbody>
  102. </table>
  103. <dl class="details">
  104. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  105. </dl>
  106. </div>
  107. <h2 class="subsection-title">Source</h2>
  108. <p>
  109. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRHandModelFactory.js" target="_blank" rel="noopener" translate="no">examples/jsm/webxr/XRHandModelFactory.js</a>
  110. </p>
  111. </article>
  112. </section>
  113. <script src="../scripts/linenumber.js"></script>
  114. <script src="../scripts/page.js"></script>
  115. </body>
  116. </html>
粤ICP备19079148号