OculusHandPointerModel.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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" rel="noopener">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"><a href="Group.html">Group</a></span>, controller : <span class="param-type"><a href="Group.html">Group</a></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">
  33. <strong>hand</strong>
  34. </td>
  35. <td class="description last">
  36. <p>The hand controller.</p>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="name">
  41. <strong>controller</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The WebXR controller in target ray space.</p>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. <h2 class="subsection-title">Properties</h2>
  52. <div class="member">
  53. <h3 class="name" id="attached" translate="no">.<a href="#attached">attached</a><span class="type-signature"> : boolean</span> </h3>
  54. <div class="description">
  55. <p>Whether the model is attached or not.</p>
  56. <p>Default is <code>false</code>.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="controller" translate="no">.<a href="#controller">controller</a><span class="type-signature"> : <a href="Group.html">Group</a></span> </h3>
  61. <div class="description">
  62. <p>The WebXR controller in target ray space.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="cursorObject" translate="no">.<a href="#cursorObject">cursorObject</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  67. <div class="description">
  68. <p>The cursor object.</p>
  69. <p>Default is <code>null</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="hand" translate="no">.<a href="#hand">hand</a><span class="type-signature"> : <a href="Group.html">Group</a></span> </h3>
  74. <div class="description">
  75. <p>The hand controller.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="pinched" translate="no">.<a href="#pinched">pinched</a><span class="type-signature"> : boolean</span> </h3>
  80. <div class="description">
  81. <p>Whether the model is pinched or not.</p>
  82. <p>Default is <code>false</code>.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="pointerGeometry" translate="no">.<a href="#pointerGeometry">pointerGeometry</a><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  87. <div class="description">
  88. <p>The pointer geometry.</p>
  89. <p>Default is <code>null</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="pointerMesh" translate="no">.<a href="#pointerMesh">pointerMesh</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
  94. <div class="description">
  95. <p>The pointer mesh.</p>
  96. <p>Default is <code>null</code>.</p>
  97. </div>
  98. </div>
  99. <div class="member">
  100. <h3 class="name" id="pointerObject" translate="no">.<a href="#pointerObject">pointerObject</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
  101. <div class="description">
  102. <p>The pointer object that holds the pointer mesh.</p>
  103. <p>Default is <code>null</code>.</p>
  104. </div>
  105. </div>
  106. <div class="member">
  107. <h3 class="name" id="raycaster" translate="no">.<a href="#raycaster">raycaster</a><span class="type-signature"> : <a href="Raycaster.html">Raycaster</a></span> </h3>
  108. <div class="description">
  109. <p>The internal raycaster used for detecting
  110. intersections.</p>
  111. <p>Default is <code>null</code>.</p>
  112. </div>
  113. </div>
  114. <h2 class="subsection-title">Methods</h2>
  115. <h3 class="name name-method" id="checkIntersections" translate="no">.<a href="#checkIntersections">checkIntersections</a><span class="signature">( objects : <span class="param-type">Array.&lt;<a href="Object3D.html">Object3D</a>></span>, recursive : <span class="param-type">boolean</span> )</span> </h3>
  116. <div class="method">
  117. <div class="description">
  118. <p>Checks for intersections between the model's raycaster and the given objects. The method
  119. updates the cursor object to the intersection point.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name">
  125. <strong>objects</strong>
  126. </td>
  127. <td class="description last">
  128. <p>The 3D objects to check for intersection with the ray.</p>
  129. </td>
  130. </tr>
  131. <tr>
  132. <td class="name">
  133. <strong>recursive</strong>
  134. </td>
  135. <td class="description last">
  136. <p>If set to <code>true</code>, it also checks all descendants.
  137. Otherwise it only checks intersection with the object.</p>
  138. <p>Default is <code>false</code>.</p>
  139. </td>
  140. </tr>
  141. </tbody>
  142. </table>
  143. </div>
  144. <h3 class="name name-method" id="createPointer" translate="no">.<a href="#createPointer">createPointer</a><span class="signature">()</span> </h3>
  145. <div class="method">
  146. <div class="description">
  147. <p>Creates a pointer mesh and adds it to this model.</p>
  148. </div>
  149. </div>
  150. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  151. <div class="method">
  152. <div class="description">
  153. <p>Frees the GPU-related resources allocated by this instance. Call this
  154. method whenever this instance is no longer used in your app.</p>
  155. </div>
  156. </div>
  157. <h3 class="name name-method" id="intersectObject" translate="no">.<a href="#intersectObject">intersectObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></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>
  158. <div class="method">
  159. <div class="description">
  160. <p>Performs an intersection test with the model's raycaster and the given object.</p>
  161. </div>
  162. <table class="params">
  163. <tbody>
  164. <tr>
  165. <td class="name">
  166. <strong>object</strong>
  167. </td>
  168. <td class="description last">
  169. <p>The 3D object to check for intersection with the ray.</p>
  170. </td>
  171. </tr>
  172. <tr>
  173. <td class="name">
  174. <strong>recursive</strong>
  175. </td>
  176. <td class="description last">
  177. <p>If set to <code>true</code>, it also checks all descendants.
  178. Otherwise it only checks intersection with the object.</p>
  179. <p>Default is <code>true</code>.</p>
  180. </td>
  181. </tr>
  182. </tbody>
  183. </table>
  184. <dl class="details">
  185. <dt class="tag-returns"><strong>Returns:</strong> An array holding the intersection points.</dt>
  186. </dl>
  187. </div>
  188. <h3 class="name name-method" id="intersectObjects" translate="no">.<a href="#intersectObjects">intersectObjects</a><span class="signature">( objects : <span class="param-type">Array.&lt;<a href="Object3D.html">Object3D</a>></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>
  189. <div class="method">
  190. <div class="description">
  191. <p>Performs an intersection test with the model's raycaster and the given objects.</p>
  192. </div>
  193. <table class="params">
  194. <tbody>
  195. <tr>
  196. <td class="name">
  197. <strong>objects</strong>
  198. </td>
  199. <td class="description last">
  200. <p>The 3D objects to check for intersection with the ray.</p>
  201. </td>
  202. </tr>
  203. <tr>
  204. <td class="name">
  205. <strong>recursive</strong>
  206. </td>
  207. <td class="description last">
  208. <p>If set to <code>true</code>, it also checks all descendants.
  209. Otherwise it only checks intersection with the object.</p>
  210. <p>Default is <code>true</code>.</p>
  211. </td>
  212. </tr>
  213. </tbody>
  214. </table>
  215. <dl class="details">
  216. <dt class="tag-returns"><strong>Returns:</strong> An array holding the intersection points.</dt>
  217. </dl>
  218. </div>
  219. <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>
  220. <div class="method">
  221. <div class="description">
  222. <p>Returns <code>true</code> is the model is attached.</p>
  223. </div>
  224. <dl class="details">
  225. <dt class="tag-returns"><strong>Returns:</strong> Whether the model is attached or not.</dt>
  226. </dl>
  227. </div>
  228. <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>
  229. <div class="method">
  230. <div class="description">
  231. <p>Returns <code>true</code> is the model is pinched.</p>
  232. </div>
  233. <dl class="details">
  234. <dt class="tag-returns"><strong>Returns:</strong> Whether the model is pinched or not.</dt>
  235. </dl>
  236. </div>
  237. <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>
  238. <div class="method">
  239. <div class="description">
  240. <p>Sets the attached state.</p>
  241. </div>
  242. <table class="params">
  243. <tbody>
  244. <tr>
  245. <td class="name">
  246. <strong>attached</strong>
  247. </td>
  248. <td class="description last">
  249. <p>Whether the model is attached or not.</p>
  250. </td>
  251. </tr>
  252. </tbody>
  253. </table>
  254. </div>
  255. <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>
  256. <div class="method">
  257. <div class="description">
  258. <p>Sets the cursor to the given distance.</p>
  259. </div>
  260. <table class="params">
  261. <tbody>
  262. <tr>
  263. <td class="name">
  264. <strong>distance</strong>
  265. </td>
  266. <td class="description last">
  267. <p>The distance to set the cursor to.</p>
  268. </td>
  269. </tr>
  270. </tbody>
  271. </table>
  272. </div>
  273. <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>
  274. <div class="method">
  275. <div class="description">
  276. <p>Overwritten with a custom implementation. Makes sure the internal pointer and raycaster are updated.</p>
  277. </div>
  278. <table class="params">
  279. <tbody>
  280. <tr>
  281. <td class="name">
  282. <strong>force</strong>
  283. </td>
  284. <td class="description last">
  285. <p>When set to <code>true</code>, a recomputation of world matrices is forced even
  286. when <a href="Object3D.html#matrixWorldAutoUpdate">Object3D#matrixWorldAutoUpdate</a> is set to <code>false</code>.</p>
  287. <p>Default is <code>false</code>.</p>
  288. </td>
  289. </tr>
  290. </tbody>
  291. </table>
  292. <dl class="details">
  293. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Object3D.html#updateMatrixWorld">Object3D#updateMatrixWorld</a></dt>
  294. </dl>
  295. </div>
  296. <h2 class="subsection-title">Source</h2>
  297. <p>
  298. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/OculusHandPointerModel.js" translate="no" target="_blank" rel="noopener">examples/jsm/webxr/OculusHandPointerModel.js</a>
  299. </p>
  300. </article>
  301. </section>
  302. <script src="../scripts/linenumber.js"></script>
  303. <script src="../scripts/page.js"></script>
  304. </body>
  305. </html>
粤ICP备19079148号