ArcCamera Question

Hi guys,I have a question
I have a arcRotateCamera, and a sphere as origin, and a mesh box
I want to connect the camera and sphere to the box in a straight line. just like Planetary alignment.

I thought that it should be to control the alpha and beta of the camera.
Here is the example,
https://playground.babylonjs.com/#944MCH

From the camera view, the sphere and the box should overlap.

This picture explains that if the position of the box is on the camera’s alpha: Math.PI / 2, beta: Math.PI / 2, then the position of my camera should be at alpha: -Math.PI / 2, beta: Math.PI /2 position, right?

thank you.

ping @PolygonalSun

Here is one possibility

2 Likes

Hey @meleelin, in the example that you provided, your box’s position is at (2,0,3). If we look at the x,z axes as a sort of graph, we can see that the box has an alpha angle of roughly 0.9823. For our camera to line up with both the sphere and box, we’d need to either add or subtract PI to get the alpha from the opposite side. If we subtract it, we get about -2.1588 which matches up with the value that you’ll get by manually rotating it.

3 Likes