I was thinking about this kind of check:
https://jsfiddle.net/szyt9nka/1/
const myDelay = new CustomDelay();
var camX = camera.position.x;
var camY = camera.position.y;
var camZ = camera.position.z;
function render() {
if (camX !== camera.position.x && camY !== camera.position.y && camZ !== camera.position.z) {
myDelay.Timeout(() => {
cameraOrbitChange();
}, 1000);
}
camX = camera.position.x;
camY = camera.position.y;
camZ = camera.position.z;
renderer.render(scene, camera);
}
but in your fiddle you’re rendering scene after camera update, so you could also use this code:
const myDelay = new CustomDelay();
function render() {
myDelay.Timeout(() => {
cameraOrbitChange();
}, 1000);
renderer.render(scene, camera);
}
Edit: black box shows up because you forgot to call render function