I would like to recreate the Three.js OrbitControl movement without the click & drag, i.e. simply making the camera following mouse movement.
I tried to recreate it from scratch, but it was too much effort as the problem is that the camera moves on three axis, not just two. I'm pretty sure some has done before.
Specifically I would like the camera to move around the scene origin keeping the same distance from it.
OrbitControls
works: it uses a target and a camera, essentially a vector. The input toOrbitControls
makes calculations on this vector "camera -> target". E.g. a rotation would take the current angle of that vector (relative to some axis), modify that angle by the desired amount, and then move the camera to the new endpoint of the vector plus rotate it towards the target. The length of the vector stays constant, and so does your distance to the target. – LeeftrotateLeft
androtateUp
methods (they also handle Right and Down), these are already used to change the angle of the vector inhandleMouseMoveRotate
. – Leeft