I want to add a button to my viewer that will present the "reverse angle" of our model to the user. I'd like the result to be essentially what the user see when they free orbit the model dragging exactly horizontally across the screen, through the centre of the model.
The use case here is where we want to be able to lock the view, but give the user the ability to pan and to see the reverse angle - without enabling things like orbit or free orbit.
Here's what I've done so far:
var currentPosition = viewer.navigation.getPosition();
var newX = -currentPosition.x;
var newY = -currentPosition.y;
var newZ = -currentPosition.z;
var newPosition = {
x: newX,
y: newY,
z: newZ
};
viewer.navigation.setView(newPosition,
viewer.navigation.getTarget());
But this gives us some undesired behaviour when the model is panned away from the pivot - this code takes a model sitting right of centre on the screen and lands it left of centre. I'd like to rotate the model around itself, as a horizontal drag in free orbit would.