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