Kim
Kim

Reputation: 4633

How to position the camera to look at an object

I have a scene with a THREE.Object3D object in it. The object consists of several child objects, so it does not have geometry directly.

How can I position and focus the camera to look at the object?

Upvotes: 0

Views: 182

Answers (1)

mrdoob
mrdoob

Reputation: 19602

camera.position.copy( object.position );
camera.position.z += object.geometry.boundingSphere.radius;
camera.lookAt( object );

Upvotes: 3

Related Questions