I'm trying to make a rotation vertically and horizontally around a point at the same time but I'm not able to combine both.
I have this formula for the horizontal rotation:
camera.position.x = x * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - x * Math.sin(inc)
And this one for the vertical:
camera.position.y = y * Math.cos(inc) + z * Math.sin(inc)
camera.position.z = z * Math.cos(inc) - y * Math.sin(inc)
I guess I need to use a Matrix, but not sure how. Here an example with Three.js: https://codepen.io/josema/pen/xyQoga