OculusHandPointerModel.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>OculusHandPointerModel - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → </p>
  13. <h1 translate="no">OculusHandPointerModel</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Represents an Oculus hand pointer model.</p></div>
  17. </header>
  18. <article>
  19. <h2 class="subsection-title">Import</h2>
  20. <p><span translate="no">OculusHandPointerModel</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  21. <pre><code class="language-js">import { OculusHandPointerModel } from 'three/addons/webxr/OculusHandPointerModel.js';</code></pre>
  22. <div class="container-overview">
  23. <h2>Constructor</h2>
  24. <h3 class="name name-method" id="OculusHandPointerModel" translate="no">new <a href="#OculusHandPointerModel">OculusHandPointerModel</a><span class="signature">( hand : <span class="param-type">Group</span>, controller : <span class="param-type">Group</span> )</span> </h3>
  25. <div class="method">
  26. <div class="description">
  27. <p>Constructs a new Oculus hand model.</p>
  28. </div>
  29. <table class="params">
  30. <tbody>
  31. <tr>
  32. <td class="name"><code>hand</code></td>
  33. <td class="description last"><p>The hand controller.</p></td>
  34. </tr>
  35. <tr>
  36. <td class="name"><code>controller</code></td>
  37. <td class="description last"><p>The WebXR controller in target ray space.</p></td>
  38. </tr>
  39. </tbody>
  40. </table>
  41. </div>
  42. </div>
  43. <h2 class="subsection-title">Properties</h2>
  44. <div class="member">
  45. <h3 class="name" id="attached" translate="no">.<a href="#attached">attached</a><span class="type-signature"> : boolean</span> </h3>
  46. <div class="description">
  47. <p>Whether the model is attached or not.<br/>Default is <code>false</code>.</p>
  48. </div>
  49. </div>
  50. <div class="member">
  51. <h3 class="name" id="controller" translate="no">.<a href="#controller">controller</a><span class="type-signature"> : <a href="Group.html">Group</a></span> </h3>
  52. <div class="description">
  53. <p>The WebXR controller in target ray space.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="cursorObject" translate="no">.<a href="#cursorObject">cursorObject</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  58. <div class="description">
  59. <p>The cursor object.<br/>Default is <code>null</code>.</p>
  60. </div>
  61. </div>
  62. <div class="member">
  63. <h3 class="name" id="hand" translate="no">.<a href="#hand">hand</a><span class="type-signature"> : <a href="Group.html">Group</a></span> </h3>
  64. <div class="description">
  65. <p>The hand controller.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="pinched" translate="no">.<a href="#pinched">pinched</a><span class="type-signature"> : boolean</span> </h3>
  70. <div class="description">
  71. <p>Whether the model is pinched or not.<br/>Default is <code>false</code>.</p>
  72. </div>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="pointerGeometry" translate="no">.<a href="#pointerGeometry">pointerGeometry</a><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  76. <div class="description">
  77. <p>The pointer geometry.<br/>Default is <code>null</code>.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="pointerMesh" translate="no">.<a href="#pointerMesh">pointerMesh</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  82. <div class="description">
  83. <p>The pointer mesh.<br/>Default is <code>null</code>.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="pointerObject" translate="no">.<a href="#pointerObject">pointerObject</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  88. <div class="description">
  89. <p>The pointer object that holds the pointer mesh.<br/>Default is <code>null</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="raycaster" translate="no">.<a href="#raycaster">raycaster</a><span class="type-signature"> : <a href="Raycaster.html">Raycaster</a></span> </h3>
  94. <div class="description">
  95. <p>The internal raycaster used for detecting
  96. intersections.<br/>Default is <code>null</code>.</p>
  97. </div>
  98. </div>
  99. <h2 class="subsection-title">Methods</h2>
  100. <h3 class="name name-method" id="checkIntersections" translate="no">.<a href="#checkIntersections">checkIntersections</a><span class="signature">( objects : <span class="param-type">Array.&lt;Object3D></span>, recursive : <span class="param-type">boolean</span> )</span> </h3>
  101. <div class="method">
  102. <div class="description">
  103. <p>Checks for intersections between the model's raycaster and the given objects. The method
  104. updates the cursor object to the intersection point.</p>
  105. </div>
  106. <table class="params">
  107. <tbody>
  108. <tr>
  109. <td class="name"><code>objects</code></td>
  110. <td class="description last"><p>The 3D objects to check for intersection with the ray.</p></td>
  111. </tr>
  112. <tr>
  113. <td class="name"><code>recursive</code></td>
  114. <td class="description last"><p>If set to <code>true</code>, it also checks all descendants.
  115. Otherwise it only checks intersection with the object.<br/>Default is <code>false</code>.</p></td>
  116. </tr>
  117. </tbody>
  118. </table>
  119. </div>
  120. <h3 class="name name-method" id="createPointer" translate="no">.<a href="#createPointer">createPointer</a><span class="signature">()</span> </h3>
  121. <div class="method">
  122. <div class="description">
  123. <p>Creates a pointer mesh and adds it to this model.</p>
  124. </div>
  125. </div>
  126. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>Frees the GPU-related resources allocated by this instance. Call this
  130. method whenever this instance is no longer used in your app.</p>
  131. </div>
  132. </div>
  133. <h3 class="name name-method" id="intersectObject" translate="no">.<a href="#intersectObject">intersectObject</a><span class="signature">( object : <span class="param-type">Object3D</span>, recursive : <span class="param-type">boolean</span> )</span><span class="type-signature"> : Array.&lt;<a href="Raycaster.html#~Intersection">Raycaster~Intersection</a>></span> </h3>
  134. <div class="method">
  135. <div class="description">
  136. <p>Performs an intersection test with the model's raycaster and the given object.</p>
  137. </div>
  138. <table class="params">
  139. <tbody>
  140. <tr>
  141. <td class="name"><code>object</code></td>
  142. <td class="description last"><p>The 3D object to check for intersection with the ray.</p></td>
  143. </tr>
  144. <tr>
  145. <td class="name"><code>recursive</code></td>
  146. <td class="description last"><p>If set to <code>true</code>, it also checks all descendants.
  147. Otherwise it only checks intersection with the object.<br/>Default is <code>true</code>.</p></td>
  148. </tr>
  149. </tbody>
  150. </table>
  151. <dl class="details">
  152. <dt class="tag-returns"><strong>Returns:</strong> An array holding the intersection points.</dt>
  153. </dl>
  154. </div>
  155. <h3 class="name name-method" id="intersectObjects" translate="no">.<a href="#intersectObjects">intersectObjects</a><span class="signature">( objects : <span class="param-type">Array.&lt;Object3D></span>, recursive : <span class="param-type">boolean</span> )</span><span class="type-signature"> : Array.&lt;<a href="Raycaster.html#~Intersection">Raycaster~Intersection</a>></span> </h3>
  156. <div class="method">
  157. <div class="description">
  158. <p>Performs an intersection test with the model's raycaster and the given objects.</p>
  159. </div>
  160. <table class="params">
  161. <tbody>
  162. <tr>
  163. <td class="name"><code>objects</code></td>
  164. <td class="description last"><p>The 3D objects to check for intersection with the ray.</p></td>
  165. </tr>
  166. <tr>
  167. <td class="name"><code>recursive</code></td>
  168. <td class="description last"><p>If set to <code>true</code>, it also checks all descendants.
  169. Otherwise it only checks intersection with the object.<br/>Default is <code>true</code>.</p></td>
  170. </tr>
  171. </tbody>
  172. </table>
  173. <dl class="details">
  174. <dt class="tag-returns"><strong>Returns:</strong> An array holding the intersection points.</dt>
  175. </dl>
  176. </div>
  177. <h3 class="name name-method" id="isAttached" translate="no">.<a href="#isAttached">isAttached</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  178. <div class="method">
  179. <div class="description">
  180. <p>Returns <code>true</code> is the model is attached.</p>
  181. </div>
  182. <dl class="details">
  183. <dt class="tag-returns"><strong>Returns:</strong> Whether the model is attached or not.</dt>
  184. </dl>
  185. </div>
  186. <h3 class="name name-method" id="isPinched" translate="no">.<a href="#isPinched">isPinched</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  187. <div class="method">
  188. <div class="description">
  189. <p>Returns <code>true</code> is the model is pinched.</p>
  190. </div>
  191. <dl class="details">
  192. <dt class="tag-returns"><strong>Returns:</strong> Whether the model is pinched or not.</dt>
  193. </dl>
  194. </div>
  195. <h3 class="name name-method" id="setAttached" translate="no">.<a href="#setAttached">setAttached</a><span class="signature">( attached : <span class="param-type">boolean</span> )</span> </h3>
  196. <div class="method">
  197. <div class="description">
  198. <p>Sets the attached state.</p>
  199. </div>
  200. <table class="params">
  201. <tbody>
  202. <tr>
  203. <td class="name"><code>attached</code></td>
  204. <td class="description last"><p>Whether the model is attached or not.</p></td>
  205. </tr>
  206. </tbody>
  207. </table>
  208. </div>
  209. <h3 class="name name-method" id="setCursor" translate="no">.<a href="#setCursor">setCursor</a><span class="signature">( distance : <span class="param-type">number</span> )</span> </h3>
  210. <div class="method">
  211. <div class="description">
  212. <p>Sets the cursor to the given distance.</p>
  213. </div>
  214. <table class="params">
  215. <tbody>
  216. <tr>
  217. <td class="name"><code>distance</code></td>
  218. <td class="description last"><p>The distance to set the cursor to.</p></td>
  219. </tr>
  220. </tbody>
  221. </table>
  222. </div>
  223. <h3 class="name name-method" id="updateMatrixWorld" translate="no">.<a href="#updateMatrixWorld">updateMatrixWorld</a><span class="signature">( force : <span class="param-type">boolean</span> )</span> </h3>
  224. <div class="method">
  225. <div class="description">
  226. <p>Overwritten with a custom implementation. Makes sure the internal pointer and raycaster are updated.</p>
  227. </div>
  228. <table class="params">
  229. <tbody>
  230. <tr>
  231. <td class="name"><code>force</code></td>
  232. <td class="description last"><p>When set to <code>true</code>, a recomputation of world matrices is forced even
  233. when <a href="Object3D.html#matrixWorldAutoUpdate">Object3D#matrixWorldAutoUpdate</a> is set to <code>false</code>.<br/>Default is <code>false</code>.</p></td>
  234. </tr>
  235. </tbody>
  236. </table>
  237. <dl class="details">
  238. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Object3D.html#updateMatrixWorld">Object3D#updateMatrixWorld</a></dt>
  239. </dl>
  240. </div>
  241. <h2 class="subsection-title">Source</h2>
  242. <p>
  243. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/OculusHandPointerModel.js" target="_blank" rel="noopener" translate="no">examples/jsm/webxr/OculusHandPointerModel.js</a>
  244. </p>
  245. </article>
  246. </section>
  247. <script src="../scripts/linenumber.js"></script>
  248. <script src="../scripts/page.js"></script>
  249. </body>
  250. </html>
粤ICP备19079148号