我尝试过使用aerotwist的教程。一切顺利,直到我搞砸THREE.PlaneGeometry,如下面的代码:
var $container = $('#container');
var WIDTH = $container.width(), HEIGHT = $container.height();
var VIEW_ANGLE = 45, ASPECT = WIDTH / HEIGHT, NEAR = 0.1, FAR = 10000;
var renderer = new THREE.WebGLRenderer();
var camera = new THREE.PerspectiveCamera(VIEW_ANGLE, ASPECT, NEAR, FAR);
var scene = new THREE.Scene();
camera.position.z = 300;
renderer.setSize(WIDTH, HEIGHT);
$container.append(renderer.domElement);
// create the mesh's material
var meshMaterial = new THREE.MeshBasicMaterial({color:0xCC0000});
var mesh = new THREE.Mesh(new THREE.CubeGeometry(100,100,1,1),meshMaterial);
// add the mesh to the scene
scene.add(mesh);
scene.add(camera);
renderer.render(scene, camera);
当我从
更改行时var mesh = new THREE.Mesh(new THREE.CubeGeometry(100,100,1,1),meshMaterial);
到
var mesh = new THREE.Mesh(new THREE.PlaneGeometry(100,100,1,1),meshMaterial);
或
var mesh = new THREE.Mesh(new THREE.PlaneGeometry(100,100),meshMaterial);
然后什么都没有呈现。有什么问题?
答案 0 :(得分:3)
它可能不是双面的,或者你当前的角度看不到它,请检查js fiddle of plane rotating并练习那个练习。
修改强>
看起来飞机朝下,因此相机无法看到它,我更改了mesh.rotation.x
以证明它确实渲染。
请参阅 - updated example
答案 1 :(得分:0)
尼尔的回答是我先尝试的;也可能是您的比例(至少在一个轴上)设置为0或NaN。