Can I make my floor solid?

I’m so close to completing my project, hyped to share it with you guys soon.

I have one question, i’m using a PerspectiveCamera (which is awesome as i have full control)

function createCamera(cameraX, cameraY) {
  camera = new THREE.PerspectiveCamera(
    100, // FOV
    container.clientWidth / container.clientHeight, // aspect
    0.1, // near clipping plane
    3000, // far clipping plane
  );
  camera.position.set(cameraX, 150, cameraY);
}

Also my 3D render has a ‘floor’ (for lack of a better term)

function createSceneFloor() {
  var geometry = new THREE.PlaneGeometry( 10000, 10000, 1, 1 );
  // change floor color
	var material = new THREE.MeshBasicMaterial({color:0xcccccc});
	var floor = new THREE.Mesh(geometry, material)
  floor.material.side = THREE.DoubleSide
	floor.rotation.x = 90 * Math.PI / 180
	scene.add(floor)
}

So my question is, how cant i stop my camera from going under the floor? Would it be better to make the floor solid (something i have not achieved yet), or do you set the camera to never swing below 0 degrees maybe (I can’t find any posts about this)?

As usual any help is really appreciated! Thanks

When using OrbitControls to control the camera, you can set maxPolarAngle to define how far the user can orbit vertically.

Live example: https://jsfiddle.net/hs7rj3eo/1/

3 Likes

you, are, the, MAN!

2 Likes