I am facing an issue with two cameras in one scene, one viewport, and one renderer. I switch between cameras using HTML buttons.
ISSUES
Issue 1
When using camera1, there is no response from moving the mouse. However, when I switch to camera2, the orbit control works fine. Upon toggling back to camera1, the mouse movement still does not work.
To view the original problem where there was no response from camera1, refer to: jsfiddle.net/steveow/xu0k1z75/
UPDATE: Issue 1 has been fixed by Stallion - avoid setting the camera position to (0,0,0).
Issue 2
With camera1, there is a lingering problem where Pan and Dolly movements are very slow initially. They might speed up later but then become excessively fast.
To see the issue with camera1 Pan & Dolly being slow at first, visit: http://jsfiddle.net/steveow/uk94hxrp/
UPDATE: The slowness in Pan & Dolly movements is due to the camera being too close to the OrbitControls target position. By choosing a different .target position, this slowness can be avoided.
NOTES
I have tried creating a new THREE.OrbitControls object each time I switch cameras. Alternatively, I attempted to create two persistent THREE.OrbitControls objects during initialization and assign a general variable "controls" to the active one. Different methods like including controls.update() in the animation loop have also been tested.
Although it worked with either camera before, I seem unable to replicate that success now.
I have examined the OrbitControls code but remain puzzled by it.
CODE (same as original Problem, Issue 1 with slight modifications)
Below is the camera initiation code:
//... camera1
// Camera1 specifications
// camera2
// Camera2 specifications
Animation, camera switching, and resetting code:
//----------------------------------------------------------------
function F_frame()
{
//... Render
}//... EOF Frame().
//-------------------------------------------------------------
function F_Switch_Camera()
{
// Switching between cameras
}
//----------------------------------------------------------------------
function F_Reset_Camera1()
{
// Resetting Camera1 position and orientation
}
//----------------------------------------------------------------------
function F_Reset_Camera2()
{
// Resetting Camera2 position and orientation
}
UPDATE
Credits to user Stallion for the straightforward resolution - avoid setting the camera world position to (0,0,0) and use (0,0,1) instead.