I want to setup an OrthographicCamera for a custom shadow mapping computation and I would like this camera to look at a specific target.
This is what I am doing:
const boundSphere = target.boundingSphere; const lightCamera = new THREE.OrthographicCamera( -boundSphere.radius, boundSphere.radius, boundSphere.radius, -boundSphere.radius, 0., 2 * boundSphere.radius ); lightCamera.position.set(0., 0., boundSphere.radius); lightCamera.lookAt(boundSphere.center);
Is there a better approach than this? Is there a builtin ThreeJS function/method that I can use?