XRHandModelFactory.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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" rel="noopener">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"><a href="GLTFLoader.html">GLTFLoader</a></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">
  39. <strong>gltfLoader</strong>
  40. </td>
  41. <td class="description last">
  42. <p>A glTF loader that is used to load hand models.</p>
  43. <p>Default is <code>null</code>.</p>
  44. </td>
  45. </tr>
  46. <tr>
  47. <td class="name">
  48. <strong>onLoad</strong>
  49. </td>
  50. <td class="description last">
  51. <p>A callback that is executed when a hand model has been loaded.</p>
  52. <p>Default is <code>null</code>.</p>
  53. </td>
  54. </tr>
  55. </tbody>
  56. </table>
  57. </div>
  58. </div>
  59. <h2 class="subsection-title">Properties</h2>
  60. <div class="member">
  61. <h3 class="name" id="gltfLoader" translate="no">.<a href="#gltfLoader">gltfLoader</a><span class="type-signature"> : <a href="GLTFLoader.html">GLTFLoader</a></span> </h3>
  62. <div class="description">
  63. <p>A glTF loader that is used to load hand models.</p>
  64. <p>Default is <code>null</code>.</p>
  65. </div>
  66. </div>
  67. <div class="member">
  68. <h3 class="name" id="onLoad" translate="no">.<a href="#onLoad">onLoad</a><span class="type-signature"> : function</span> </h3>
  69. <div class="description">
  70. <p>A callback that is executed when a hand model has been loaded.</p>
  71. <p>Default is <code>null</code>.</p>
  72. </div>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="path" translate="no">.<a href="#path">path</a><span class="type-signature"> : string</span> </h3>
  76. <div class="description">
  77. <p>The path to the model repository.</p>
  78. <p>Default is <code>null</code>.</p>
  79. </div>
  80. </div>
  81. <h2 class="subsection-title">Methods</h2>
  82. <h3 class="name name-method" id="createHandModel" translate="no">.<a href="#createHandModel">createHandModel</a><span class="signature">( controller : <span class="param-type"><a href="Group.html">Group</a></span>, profile : <span class="param-type">'spheres' | 'boxes' | 'mesh'</span> )</span><span class="type-signature"> : <a href="XRHandModel.html">XRHandModel</a></span> </h3>
  83. <div class="method">
  84. <div class="description">
  85. <p>Creates a controller model for the given WebXR hand controller.</p>
  86. </div>
  87. <table class="params">
  88. <tbody>
  89. <tr>
  90. <td class="name">
  91. <strong>controller</strong>
  92. </td>
  93. <td class="description last">
  94. <p>The hand controller.</p>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td class="name">
  99. <strong>profile</strong>
  100. </td>
  101. <td class="description last">
  102. <p>The model profile that defines the model type.</p>
  103. </td>
  104. </tr>
  105. </tbody>
  106. </table>
  107. <dl class="details">
  108. <dt class="tag-returns"><strong>Returns:</strong> The XR hand model.</dt>
  109. </dl>
  110. </div>
  111. <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>
  112. <div class="method">
  113. <div class="description">
  114. <p>Sets the path to the hand model repository.</p>
  115. </div>
  116. <table class="params">
  117. <tbody>
  118. <tr>
  119. <td class="name">
  120. <strong>path</strong>
  121. </td>
  122. <td class="description last">
  123. <p>The path to set.</p>
  124. </td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. <dl class="details">
  129. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  130. </dl>
  131. </div>
  132. <h2 class="subsection-title">Source</h2>
  133. <p>
  134. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRHandModelFactory.js" translate="no" target="_blank" rel="noopener">examples/jsm/webxr/XRHandModelFactory.js</a>
  135. </p>
  136. </article>
  137. </section>
  138. <script src="../scripts/linenumber.js"></script>
  139. <script src="../scripts/page.js"></script>
  140. </body>
  141. </html>
粤ICP备19079148号