| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>ArrowHelper - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → </p>
- <h1 translate="no">ArrowHelper</h1>
- <section>
- <header>
- <div class="class-description"><p>An 3D arrow object for visualizing directions.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const dir = new THREE.Vector3( 1, 2, 0 );
- //normalize the direction vector (convert to vector of length 1)
- dir.normalize();
- const origin = new THREE.Vector3( 0, 0, 0 );
- const length = 1;
- const hex = 0xffff00;
- const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex );
- scene.add( arrowHelper );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="ArrowHelper" translate="no">new <a href="#ArrowHelper">ArrowHelper</a><span class="signature">( dir : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, origin : <span class="param-type"><a href="Vector3.html">Vector3</a></span>, length : <span class="param-type">number</span>, color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span>, headLength : <span class="param-type">number</span>, headWidth : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new arrow helper.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>dir</strong>
- </td>
- <td class="description last">
- <p>The (normalized) direction vector.</p>
- <p>Default is <code>(0, 0, 1)</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>origin</strong>
- </td>
- <td class="description last">
- <p>Point at which the arrow starts.</p>
- <p>Default is <code>(0, 0, 0)</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>length</strong>
- </td>
- <td class="description last">
- <p>Length of the arrow in world units.</p>
- <p>Default is <code>1</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>color</strong>
- </td>
- <td class="description last">
- <p>Color of the arrow.</p>
- <p>Default is <code>0xffff00</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>headLength</strong>
- </td>
- <td class="description last">
- <p>The length of the head of the arrow.</p>
- <p>Default is <code>length*0.2</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>headWidth</strong>
- </td>
- <td class="description last">
- <p>The width of the head of the arrow.</p>
- <p>Default is <code>headLength*0.2</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="cone" translate="no">.<a href="#cone">cone</a><span class="type-signature"> : <a href="Mesh.html">Mesh</a></span> </h3>
- <div class="description">
- <p>The cone part of the arrow helper.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="line" translate="no">.<a href="#line">line</a><span class="type-signature"> : <a href="Line.html">Line</a></span> </h3>
- <div class="description">
- <p>The line part of the arrow helper.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Frees the GPU-related resources allocated by this instance. Call this
- method whenever this instance is no longer used in your app.</p>
- </div>
- </div>
- <h3 class="name name-method" id="setColor" translate="no">.<a href="#setColor">setColor</a><span class="signature">( color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the color of the helper.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>color</strong>
- </td>
- <td class="description last">
- <p>The color to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="setDirection" translate="no">.<a href="#setDirection">setDirection</a><span class="signature">( dir : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the direction of the helper.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>dir</strong>
- </td>
- <td class="description last">
- <p>The normalized direction vector.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h3 class="name name-method" id="setLength" translate="no">.<a href="#setLength">setLength</a><span class="signature">( length : <span class="param-type">number</span>, headLength : <span class="param-type">number</span>, headWidth : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the length of the helper.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>length</strong>
- </td>
- <td class="description last">
- <p>Length of the arrow in world units.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>headLength</strong>
- </td>
- <td class="description last">
- <p>The length of the head of the arrow.</p>
- <p>Default is <code>length*0.2</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>headWidth</strong>
- </td>
- <td class="description last">
- <p>The width of the head of the arrow.</p>
- <p>Default is <code>headLength*0.2</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/ArrowHelper.js" translate="no" target="_blank" rel="noopener">src/helpers/ArrowHelper.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|