Hi, I'm using THREE.PointerLockControls and whenever I use them I can't get anything to show up except the ground.
My code is based on what I see here: https://github.com/mrdoob/three.js/blob/master/examples/misc_controls_pointerlock.html
I know that it works because when I switch to orbit controls (and disable pointerLock) everything works just fine.
I know that pointerLock works because I can look around using my mouse.

          //controls = new THREE.OrbitControls(camera, renderer.domElement);
          controls = new THREE.PointerLockControls(camera);
          scene.add(controls.getObject());
          //Set scene background color
          renderer.setClearColorHex(0x333F47, 1);
          //Create Light Source
          var light = new THREE.PointLight(0xffffff);
          light.position.set(-100, 200, 100);
          scene.add(light);
          geometry = new THREE.PlaneGeometry(2000, 2000, 100, 100);
          var material = new THREE.MeshLambertMaterial({color: 0x0000FF});
          geometry.applyMatrix(new THREE.Matrix4().makeRotationX(- Math.PI / 2));
          var floor = new THREE.Mesh(geometry, material);
          scene.add(floor);          
          var geometry = new THREE.CubeGeometry(2, 2, 2);
          geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
          var material = new THREE.MeshBasicMaterial({color: 0x00000, wireframe: true});
          cube1= new THREE.Mesh(geometry, material);
          scene.add(cube1);
          var geometry = new THREE.CubeGeometry(1, 1, 1);
          geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
          var material = new THREE.MeshLambertMaterial({color: 0xFF0000, wireframe: false});
          cube2 = new THREE.Mesh(geometry, material);
          scene.add(cube2);
          cube2.position = {x: 2, y: 2, z: 0};
Member Avatar for LastMitch

Hi, I'm using THREE.PointerLockControls and whenever I use them I can't get anything to show up except the ground.

@SamarthWiz

Did you ask the author why it show up except the ground?

The reason is that the author wrote it plus the author can explain why it works like that.

There is an demo for this? Did you look at the demo?

Apparently PointerLockControls can sometimes glitch and not show anything underneath you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.