如何使大纲影响与THREE.js editor相同?
我试过这个:
// child = child of my object
var outlineMaterial1 = new THREE.MeshBasicMaterial( { color: 0xff0000, side: THREE.BackSide } );
var outlineMesh1 = new THREE.Mesh( child.geometry, outlineMaterial1 );
outlineMesh1.position = child.position;
outlineMesh1.scale.multiplyScalar(1.05);
scene.add( outlineMesh1 );
答案 0 :(得分:3)
你试过wireframe
吗?
var outlineMaterial1 = new THREE.MeshBasicMaterial( { color: 0xff0000, side: THREE.BackSide, wireframe: true } );
不确定您是否需要THREE.BackSide
看看parameters for MeshBasicMaterial here
您是否看过编辑器的代码,看看它是如何做到的?
编辑
我认为编辑器正在使用BoxHelper对象来创建大纲
编辑
答案 1 :(得分:0)
let geo = new THREE.EdgesGeometry(intersects[0].object.geometry);
let mat = new THREE.LineBasicMaterial({ color: "black", linewidth: 10 });
let wireframe = new THREE.LineSegments(geo, mat);
wireframe.renderOrder = 1; // make sure wireframes are rendered 2nd
intersects[0].object.add(wireframe);