export const setCameraImmediately = (cameraCoordinates: CameraCoordinates) => {
const scene = Engine.LastCreatedScene;
const camera = scene.activeCamera as ArcRotateCamera;
camera.target = new Vector3(
cameraCoordinates.target.x,
cameraCoordinates.target.y,
cameraCoordinates.target.z
);
camera.alpha = cameraCoordinates.alpha;
camera.beta = cameraCoordinates.beta;
camera.radius = cameraCoordinates.radius;
camera.update();
};
Hmm, it works when I use this function in the playground… Can you post more code or ideally PG to show how you’re setting the scene up and calling the function?
https://playground.babylonjs.com/#9WUJN#1614
2 Likes
@haoguang_shen please create a repro in the playground so that it is easier to help you.
1 Like
Thank you, It’s my fault.
1 Like