0

My main goal is to be able to position the camera such that my object is visible dynamically.

I have read: How to Fit Camera to Object

which says I need fov, height and dist, and to me they all are unknown variables since I have not found a way to get all 3.

P.S: I'm very new to three.js

Community
  • 1
  • 1
BPm
  • 2,924
  • 11
  • 33
  • 51

1 Answers1

1

Adjust the field of view of your camera:

var fov = 50;
var camera = new THREE.PerspectiveCamera(fov, width/height, 0.1, 10000);

The higher the value of fov, the more space the camera can see.

To always have your object visible, do this:

camera.lookAt( object.position );