Target change while switch between Universal Camera and ArcRotateCamera

Hi There

If you switch between the universal camera and the arcrotatecamera the target changes. if you move one camera and change back to the other camera some movement is happening and the target is in a new unwanted position.

old example: https://www.babylonjs-playground.com/#ZBTJP#6

I tried to set the target and position new for every time you press the switch button, but it does not change this behaviour.

function switchToARCMode() {
if (isArcCamera == 0) {
SectionCutOrWTPositions();
scene.activeCamera = camera1;
bottomRight.addControl(bottomRightRotatebtnsG1); bottomRight.addControl(bottomRightRotatebtnsG2);
bottomRight.addControl(bottomRightRotatebtnsG3);
babylonGUI.removeControl(joystickGrid);
fovTextblock.text = (“”)
isArcCamera = 1;
pMove1 = 560;
pRote1 = 30;
bottomRightMovebtnsPosition();
camera1.setTarget(BABYLON.Vector3.FromArray(camTarget1));
camera1.alpha = camPosition1[0];
camera1.beta = camPosition1[1];
camera1.radius = camPosition1[2];
}
};

Does somebody knows whats is happening while switching the cameras? or how to set a new/old target to the camera while switching?

Many thanks

1 Like

The cameras are still reacting to the mouse input, you just need to call detachControl

https://www.babylonjs-playground.com/#ZBTJP#10

2 Likes

thank you very much - works