| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>BoxHelper - 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> → <a href="Line.html">Line</a> → <a href="LineSegments.html">LineSegments</a> → </p>
- <h1 translate="no">BoxHelper</h1>
- <section>
- <header>
- <div class="class-description"><p>Helper object to graphically show the world-axis-aligned bounding box
- around an object. The actual bounding box is handled with <a href="Box3.html">Box3</a>,
- this is just a visual helper for debugging. It can be automatically
- resized with <a href="BoxHelper.html#update">BoxHelper#update</a> when the object it's created from
- is transformed. Note that the object must have a geometry for this to work,
- so it won't work with sprites.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const sphere = new THREE.SphereGeometry();
- const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
- const box = new THREE.BoxHelper( object, 0xffff00 );
- scene.add( box );
- </code></pre></div>
- </header>
- <article>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="BoxHelper" translate="no">new <a href="#BoxHelper">BoxHelper</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, color : <span class="param-type">number | <a href="Color.html">Color</a> | string</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new box helper.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object to show the world-axis-aligned bounding box.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>color</strong>
- </td>
- <td class="description last">
- <p>The box's color.</p>
- <p>Default is <code>0xffff00</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="object" translate="no">.<a href="#object">object</a><span class="type-signature"> : <a href="Object3D.html">Object3D</a></span> </h3>
- <div class="description">
- <p>The 3D object being visualized.</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="setFromObject" translate="no">.<a href="#setFromObject">setFromObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : <a href="BoxHelper.html">BoxHelper</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Updates the wireframe box for the passed object.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>object</strong>
- </td>
- <td class="description last">
- <p>The 3D object to create the helper for.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Updates the helper's geometry to match the dimensions of the object,
- including any children.</p>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/src/helpers/BoxHelper.js" translate="no" target="_blank" rel="noopener">src/helpers/BoxHelper.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|