BoxHelper.html 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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:LineSegments] &rarr;
  12. <h1>[name]</h1>
  13. <div 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. </div>
  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]( [page:Object3D object], [page:Color color] )</h3>
  30. <div>
  31. [page:Object3D object] -- 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. </div>
  36. <h2>Properties</h2>
  37. <div>See the base [page:LineSegments] class for common properties.</div>
  38. <h2>Methods</h2>
  39. <div>See the base [page:LineSegments] class for common methods.</div>
  40. <h3>[method:null update]( [page:Object3D object] )</h3>
  41. <div>
  42. Updates the helper's geometry to match the dimensions of the
  43. of the passed object, including any children. See [page:Box3.setFromObject].
  44. </div>
  45. <h2>Source</h2>
  46. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  47. </body>
  48. </html>