BPm
BPm

Reputation: 2994

threejs - dynamically calculate camera position using just THREE.Points

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

Upvotes: 0

Views: 723

Answers (1)

TheWebDesignerPro
TheWebDesignerPro

Reputation: 91

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 );

Upvotes: 1

Related Questions