Three.js - 错误的轴或相机旋转

nny*_*yby 3 javascript three.js

我试图将地板水平放置,但它是直立的.我的代码出了什么问题?也许相机旋转关闭?我正在使用three.js r52.

    camera = new THREE.PerspectiveCamera                                                                                            
        (45, window.innerWidth / window.innerHeight, 1, 10000);                                                                     
    camera.position.x = -500;                                                                                                       
    camera.position.z = 0;                                                                                                          

    scene = new THREE.Scene();

    var floorGeometry = new THREE.PlaneGeometry(1000, 1000, 1, 1);                                                                  
    var floorMaterial = new THREE.MeshBasicMaterial( {color:0x448844} );                                                            
    var floor = new THREE.Mesh(floorGeometry, floorMaterial);                                                                       

    scene.add(floor);

    controls = new THREE.FirstPersonControls(camera);                                                                             
    controls.movementSpeed = 1000;                                                                                                
    controls.lookSpeed = 0.0;                                                                                                     
    controls.lookVertical = true; 
Run Code Online (Sandbox Code Playgroud)

直立的PlaneGeometry

oal*_*oal 5

你的代码很好,但你必须添加它以将其旋转90度.看看这个:http://cssdeck.com/labs/threejsrotation/0(第18行:floor.rotation.x = -Math.PI / 2;)

轮换只是一个THREE.Vector3位置.