2
0

BoxHelper.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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>Code Example</h2>
  20. <code>
  21. var sphere = new THREE.SphereBufferGeometry();
  22. var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
  23. var box = new THREE.BoxHelper( object, 0xffff00 );
  24. scene.add( box );
  25. </code>
  26. <h2>Examples</h2>
  27. <p>
  28. [example:webgl_helpers WebGL / helpers]<br/>
  29. [example:webgl_loader_nrrd WebGL / loader / nrrd]<br/>
  30. [example:webgl_buffergeometry_drawrange WebGL / buffergeometry / drawrange]
  31. </p>
  32. <h2>Constructor</h2>
  33. <h3>[name]( [param:Object3D object], [param:Color color] )</h3>
  34. <p>
  35. [page:Object3D object] -- (optional) the object3D to show the world-axis-aligned boundingbox.<br />
  36. [page:Color color] -- (optional) hexadecimal value that defines the box's color. Default is 0xffff00.<br /><br />
  37. Creates a new wireframe box that bounds the passed object. Internally this uses [page:Box3.setFromObject]
  38. to calculate the dimensions. Note that this includes any children.
  39. </p>
  40. <h2>Properties</h2>
  41. <p>See the base [page:LineSegments] class for common properties.</p>
  42. <h2>Methods</h2>
  43. <p>See the base [page:LineSegments] class for common methods.</p>
  44. <h3>[method:null update]()</h3>
  45. <p>
  46. Updates the helper's geometry to match the dimensions
  47. of the object, including any children. See [page:Box3.setFromObject].
  48. </p>
  49. <h3>[method:BoxHelper setFromObject]( [param:Object3D object] )</h3>
  50. <p>
  51. [page:Object3D object] - [page:Object3D] to create the helper of.<br /><br />
  52. Updates the wireframe box for the passed object.
  53. </p>
  54. <h2>Source</h2>
  55. <p>
  56. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  57. </p>
  58. </body>
  59. </html>