Lagging or Glitching camera from from Blender gltf model

Cameras imported from a gltf model lags or glitches when interacting with controls. you see objects in the scene lag/glitch. This can be solved by adding the camera to the scene in addition to using it in the renderer

  scene = new THREE.Scene();
        renderer = new THREE.WebGLRenderer({ canvas: canvasRef.current, antialias: true, alpha: false });

        camera = gltf.cameras[0];

        camera.aspect = window.innerWidth / window.innerHeight;
        camera.updateProjectionMatrix();

        scene.add(camera) //this solves the lagging/glitching issue

        camera.position.z = 5;

        camera.updateProjectionMatrix()

        const controls = new OrbitControls( camera, renderer.domElement );

In the case you experience such; just add the camera to the scene and threejs will reconcile it for you.

1 Like

Yeah. Threejs only autoUpdates matrices of things that are in the Scene graph.
if you don’t want your camera in the scene, you have to call updateMatrix/World on it manually when you change it.

1 Like