BoxHelper.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr; [page:Line] &rarr; [page:LineSegments] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">
  14. Helper object to graphically show the world-axis-aligned bounding box around an object. The actual bounding box is handled with [page:Box3], this is just a visual helper for debugging.
  15. It can be automatically resized with the [page:BoxHelper.update] method when the object it's created from is transformed.
  16. Note that the object must have a [page:Geometry] or [page:BufferGeometry] for this to work,
  17. so it won't work with [page:Sprite Sprites].
  18. </p>
  19. <h2>Example</h2>
  20. <div>[example:webgl_helpers WebGL / helpers]</div>
  21. <div>[example:webgl_loader_nrrd WebGL / loader / nrrd]</div>
  22. <div>[example:webgl_buffergeometry_drawcalls advanced / buffergeometry / drawcalls]</div>
  23. <code>
  24. var sphere = new THREE.SphereGeometry();
  25. var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
  26. var box = new THREE.BoxHelper( object, 0xffff00 );
  27. scene.add( box );
  28. </code>
  29. <h2>Constructor</h2>
  30. <h3>[name]( [param:Object3D object], [param:Color color] )</h3>
  31. <p>
  32. [page:Object3D object] -- (optional) the object3D to show the world-axis-aligned boundingbox.<br />
  33. [page:Color color] -- (optional) hexadecimal value that defines the box's color. Default is 0xffff00.<br /><br />
  34. Creates a new wireframe box that bounds the passed object. Internally this uses [page:Box3.setFromObject]
  35. to calculate the dimensions. Note that this includes any children.
  36. </p>
  37. <h2>Properties</h2>
  38. <p>See the base [page:LineSegments] class for common properties.</p>
  39. <h2>Methods</h2>
  40. <p>See the base [page:LineSegments] class for common methods.</p>
  41. <h3>[method:null update]()</h3>
  42. <p>
  43. Updates the helper's geometry to match the dimensions
  44. of the object, including any children. See [page:Box3.setFromObject].
  45. </p>
  46. <h3>[method:BoxHelper setFromObject]( [param:Object3D object] )</h3>
  47. <p>
  48. [page:Object3D object] - [page:Object3D] to create the helper of.<br /><br />
  49. Updates the wireframe box for the passed object.
  50. </p>
  51. <h2>Source</h2>
  52. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  53. </body>
  54. </html>