BoxHelper.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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; [page:Line] &rarr; [page:LineSegments] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. 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.
  14. It can be automatically resized with the [page:BoxHelper.update] method when the object it's created from is transformed.
  15. Note that the object must have a [page:BufferGeometry] for this to work,
  16. so it won't work with [page:Sprite Sprites].
  17. </p>
  18. <h2>Code Example</h2>
  19. <code>
  20. const sphere = new THREE.SphereGeometry();
  21. const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
  22. const box = new THREE.BoxHelper( object, 0xffff00 );
  23. scene.add( box );
  24. </code>
  25. <h2>Examples</h2>
  26. <p>
  27. [example:webgl_helpers WebGL / helpers]<br/>
  28. [example:webgl_loader_nrrd WebGL / loader / nrrd]<br/>
  29. [example:webgl_buffergeometry_drawrange WebGL / buffergeometry / drawrange]
  30. </p>
  31. <h2>Constructor</h2>
  32. <h3>[name]( [param:Object3D object], [param:Color color] )</h3>
  33. <p>
  34. [page:Object3D object] -- (optional) the object3D to show the world-axis-aligned boundingbox.<br />
  35. [page:Color color] -- (optional) hexadecimal value that defines the box's color. Default is 0xffff00.<br /><br />
  36. Creates a new wireframe box that bounds the passed object. Internally this uses [page:Box3.setFromObject]
  37. to calculate the dimensions. Note that this includes any children.
  38. </p>
  39. <h2>Properties</h2>
  40. <p>See the base [page:LineSegments] class for common properties.</p>
  41. <h2>Methods</h2>
  42. <p>See the base [page:LineSegments] class for common methods.</p>
  43. <h3>[method:null update]()</h3>
  44. <p>
  45. Updates the helper's geometry to match the dimensions
  46. of the object, including any children. See [page:Box3.setFromObject].
  47. </p>
  48. <h3>[method:BoxHelper setFromObject]( [param:Object3D object] )</h3>
  49. <p>
  50. [page:Object3D object] - [page:Object3D] to create the helper of.<br /><br />
  51. Updates the wireframe box for the passed object.
  52. </p>
  53. <h2>Source</h2>
  54. <p>
  55. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  56. </p>
  57. </body>
  58. </html>