Apologies if this is long-winded, I’m still fairly new to this and I’m very stuck.
I’m currently using camera.targetScreenOffset to offset a camera in relation to two points the user has selected in the scene space.
I’ve managed to get the offset working correctly when the user has the camera position towards the x/y plane. However, when the model rotates the offset no longer works as the z-axis comes into play.
The problem I’m stuck with is the camera.targetScreenOffset only needs an x and y value. How do I calculate the screen offset when the z-axis also plays a part in the distance to offset by?
Here’s a playground which I hope shows the problem: https://playground.babylonjs.com/#EBPQH9#35