# Rotate camera to point on sphere

How do I compute ArcCamera rotation to look at point on sphere?

cc @PolygonalSun who might have any clue ?

1 Like

``````const lookAtPoint = (camera, point) => {
const direction = BABYLON.Vector3.Normalize(point.subtract(camera.target));
camera.setPosition(newPosition);
}
``````

You could also just feed your `direction` value that you used in the building of your ray as the value for `point` above. I don’t know if this answers your question but hopefully it’s a step in the right direction.

2 Likes

Hi, thanks for the quick reply. Using your provided function and a second camera I was able to accomplish the goal. I wanted to animate the camera alpha and beta between its current location and the point on sphere. I guess my real question is as follows: How would I calculate the new alpha and beta without actually moving the 2nd camera and getting updated values? Here’s a revised playground with second camera: https://playground.babylonjs.com/#SRZRWV#1251

If you just want the values, you could probably accomplish this in by first getting the new position (minus the target’s position). If you look at my previous post, you can use the same math for `newDirection` and omit the `.add(camera.target)`. From there, it’d just be some trigonometry to figure out the alpha and beta values:

``````// assuming you have some value called newDirection as described above
camera.alpha = Math.acos(newDirection.x / Math.sqrt(Math.pow(newDirection.x, 2) + Math.pow(newDirection.z, 2)));
This is pretty much how we do it in our `rebuildAnglesAndRadius` function in the ArcRotateCamera code.