How to use the BoundingBoxHelper function from three
Find comprehensive JavaScript three.BoundingBoxHelper code examples handpicked from public code repositorys.
GitHub: kevzettler/VoxLords
7 8 9 10 11 12 13 14 15 16
mesh: Trait.required, speed: 20, range: 100, init: function(){ //this.bbox = new THREE.BoundingBoxHelper(this.mesh, 0xff0000); this.mesh.position.set(this.position[0], this.position[1], this.position[2]); }, updateHandler: function(dt){
40
0
2
11 12 13 14 15 16 17 18 19 20
this.mesh.geometry.center(); this.mesh.geometry.computeBoundingBox(); this.mesh.position.set(this.position[0], this.position[1], this.position[2]); if(this.debug){ this.bbox = new THREE.BoundingBoxHelper(this.mesh, 0xff0000); this.bbox.update(); } //unsafe mutation of the classes position
40
0
2
59 60 61 62 63 64 65 66 67 68
mesh.obj.rotateOnAxis(xAxis, 90 * Math.PI / 180); calcSize(mesh) // 模型位置调整(位置调整到模型中间点) let boundingbox = new THREE.BoundingBoxHelper(mesh.obj, 0xff0000); boundingbox.update(); mesh.obj.position.x = -boundingbox.geometry.attributes.position.array[3] - mesh.size.x / 2; mesh.obj.position.y = -boundingbox.geometry.attributes.position.array[7] - mesh.size.y / 2; mesh.obj.position.z = -boundingbox.geometry.attributes.position.array[14] - mesh.size.z / 2;
3
12
3
+ 3 other calls in file
GitHub: msfeldstein/20-Portals
59 60 61 62 63 64 65 66 67 68
showOther = !showOther }) var clock = new THREE.Clock() scene1.updateMatrixWorld() var portalBox = new THREE.Box3().setFromObject(scene1.portal) var helper = new THREE.BoundingBoxHelper(scene1.portal) helper.update() // scene1.add(helper) var inPrimaryWorld = true
0
1
2
17 18 19 20 21 22 23 24 25 26
THREE.Mesh.call( this, new THREE.BoxGeometry( 1, 1, 1 ), new THREE.MeshBasicMaterial( { color: color, wireframe: true } ) ); }; THREE.BoundingBoxHelper.prototype = Object.create( THREE.Mesh.prototype ); THREE.BoundingBoxHelper.prototype.constructor = THREE.BoundingBoxHelper; THREE.BoundingBoxHelper.prototype.update = function () { this.box.setFromObject( this.object );
40
0
2
+ 5 other calls in file
171 172 173 174 175 176 177 178 179 180
} // scene.add(svgGroup); // Compute total width and height of grouped SVG objects and center const helper = new THREE.BoundingBoxHelper(svgGroup, 0xff0000); helper.update(); helper.geometry.computeBoundingBox(); const bbox = helper.geometry.boundingBox; var wo = bbox.max.x - bbox.min.x;
0
0
2
+ 5 other calls in file
three.Vector3 is the most popular function in three (22341 examples)