三个js添加平面到场景

时间:2015-04-28 10:28:00

标签: javascript three.js

我正在尝试在场景中添加一架飞机,但如果我检查儿童的场景,则不会添加任何内容。

var plane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffff00, opacity: 0.25 } ) );
plane.visible = true;
this.scene.add( plane );

1 个答案:

答案 0 :(得分:12)

试试这个:

var geo = new THREE.PlaneBufferGeometry(2000, 2000, 8, 8);
var mat = new THREE.MeshBasicMaterial({ color: 0x000000, side: THREE.DoubleSide });
var plane = new THREE.Mesh(geo, mat);

scene.add(plane);

如果你想将飞机用作地板,你必须旋转它。

plane.rotateX( - Math.PI / 2);