LoginSignup
7
7

More than 5 years have passed since last update.

【three.jsのヘルパー解説集】 ③BoundingBoxHelperの使い方

Last updated at Posted at 2016-07-12

BoundingBoxHelper

継承:THREE.Mesh
解説:オブジェクトの境界エリアを可視化してくれるヘルパーです。大雑把なあたり判定であればこのBoxを活用するとシンプルな実装で済むのでおすすめです。

デモ

Untitled.gif

実装例

javascript
var hex  = 0xff0000;

var sphereMaterial = new THREE.MeshLambertMaterial( {color: 0x00ff00} );
var sphere = new THREE.Mesh( new THREE.SphereGeometry( 30, 12, 12), sphereMaterial );
scene.add( sphere );

var bbox = new THREE.BoundingBoxHelper( sphere, hex );
bbox.update();
scene.add( bbox );

BoundingBoxHelper(object, hex)

  • object:境界を表示させたいObject3Dオブジェクト
  • hex:boxのラインの色
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7