Find the shortest distance from one dot to another

Is there anything in babylon, or just general 3d thing, can find the shortest distance from one mesh to another, for example, one mesh is focused now, when you click the button to rotate to another mesh, the camera can rotate with the shortest distance from this 2 mesh?

Just as a starting point:

Something like that?

Or if you don’t want animation:

If not what you want, can you please add more details?

1 Like

Thank you, that’s really close, I will add a playground to better explain the question, Wrap material around a box | Babylon.js Playground (babylonjs.com)
If the camera is target to the center of the face 1, and I turn the cube to face 2, when I click the button like you set in your playground, the camera should rotate directly from 2 - > 1, not 2 → 0 → 3 → 1, or any other way to 1