如何在three.js中查看两侧的自定义2D形状

时间:2013-01-14 01:54:18

标签: javascript three.js custom-object

我一般都是三.js和3d编程的新手,我用三个.js绘制一个扇区,我可以在一个方向上找到对象,但是我看不到它在相反的方向,似乎three.js示例here具有相同的现象,我怎样才能看到两个dretions中的对象?

var squareShape = new THREE.Shape();
var arc = 1/6*Math.PI
var len = 20
squareShape.moveTo( 0,0 );
squareShape.absarc( 0, 0, 20, 4/3*Math.PI, 5/3*Math.PI, false );
squareShape.moveTo( 0, 0 );
var geometry = new THREE.ExtrudeGeometry( squareShape,  {amount:0.1} );
var mesh = THREE.SceneUtils.createMultiMaterialObject( geometry, [ new THREE.MeshLambertMaterial( { color: 0xff0000 ,opacity: 1.0} ), new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true, transparent: true ,opacity: 1.0} ) ] );
mesh.position.set( 10, 10, 10  );
mesh.rotation.set( Math.PI/2, 0, Math.PI/2 );
scene.add( mesh );

1 个答案:

答案 0 :(得分:2)

在你的情况下,它将是

new THREE.MeshLambertMaterial( { color: 0xff0000, opacity: 1.0, side: THREE.DoubleSide } )