ArrowHelper.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">An 3D arrow object for visualizing directions.</p>
  13. <h2>Code Example</h2>
  14. <code>
  15. const dir = new THREE.Vector3( 1, 2, 0 );
  16. //normalize the direction vector (convert to vector of length 1)
  17. dir.normalize();
  18. const origin = new THREE.Vector3( 0, 0, 0 );
  19. const length = 1;
  20. const hex = 0xffff00;
  21. const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );
  22. scene.add( arrowHelper );
  23. </code>
  24. <h2>Examples</h2>
  25. <p>
  26. [example:webgl_shadowmesh WebGL / shadowmesh]
  27. </p>
  28. <h2>Constructor</h2>
  29. <h3>[name]([param:Vector3 dir], [param:Vector3 origin], [param:Number length], [param:Number hex], [param:Number headLength], [param:Number headWidth] )</h3>
  30. <p>
  31. [page:Vector3 dir] -- direction from origin. Must be a unit vector. <br />
  32. [page:Vector3 origin] -- Point at which the arrow starts.<br />
  33. [page:Number length] -- length of the arrow. Default is *1*.<br />
  34. [page:Number hex] -- hexadecimal value to define color. Default is 0xffff00.<br />
  35. [page:Number headLength] -- The length of the head of the arrow. Default is 0.2 * length.<br />
  36. [page:Number headWidth] -- The width of the head of the arrow. Default is 0.2 * headLength.<br />
  37. </p>
  38. <h2>Properties</h2>
  39. <p>See the base [page:Object3D] class for common properties.</p>
  40. <h3>[property:Line line]</h3>
  41. <p>Contains the line part of the arrowHelper.</p>
  42. <h3>[property:Mesh cone]</h3>
  43. <p>Contains the cone part of the arrowHelper.</p>
  44. <h2>Methods</h2>
  45. <p>See the base [page:Object3D] class for common methods.</p>
  46. <h3>[method:null setColor]([param:Color color])</h3>
  47. <p>
  48. color -- The desired color.<br /><br />
  49. Sets the color of the arrowHelper.
  50. </p>
  51. <h3>[method:null setLength]([param:Number length], [param:Number headLength], [param:Number headWidth])</h3>
  52. <p>
  53. length -- The desired length.<br />
  54. headLength -- The length of the head of the arrow.<br />
  55. headWidth -- The width of the head of the arrow.<br /><br />
  56. Sets the length of the arrowhelper.
  57. </p>
  58. <h3>[method:null setDirection]([param:Vector3 dir])</h3>
  59. <p>
  60. dir -- The desired direction. Must be a unit vector.<br /><br />
  61. Sets the direction of the arrowhelper.
  62. </p>
  63. <h2>Source</h2>
  64. <p>
  65. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  66. </p>
  67. </body>
  68. </html>