Move the arc camera according to the click

Hello to everyone.

Yesterday I asked a question. Very nice answers. You can look at:
https://forum.babylonjs.com/t/zoom-according-to-meshs-local-coordinate/2136/6

But now I have a very similar question. In the above example, clicked mesh moves and comes in front of the camera. And when you look at the mesh from the top and click, it doesn’t exactly face the camera. What I want now is that the meshes will remain fixed. Arc camera will be in front of the mesh clicked with zoom animation. (Arc camera control settings will be active.)

In this way, no matter where the Meshs, when I clicked different meshs, camera will stop in front of that mesh.

I’ve tried a lot of ways for that. The problem will be solved if I reach the z axis in the local coordinates of the meshes and stop the cameras away from the local z-5 axis and turn it into a world coordinate. Is there anyone who can help me with this?

What I want is like this:
https://www.babylonjs-playground.com/#LXZPJK#138

But this doesn’t work properly in the complex meshes in gltf. Is there a better one?

Can you explain what you mean by this? I don’t see any glTF assets being loaded in any of the playgrounds.

I think I solved the problem. :sweat_smile: The result I want is:

https://www.babylonjs-playground.com/#LXZPJK#139

  • No matter where the camera and mesh are located in complex mesh, I bring the arc camera right across the mesh you clicked. The meshes don’t move here. It stays constant. Only the camera is moving. The camera comes with the zoom animation, right in front of the mesh you clicked.
3 Likes