Question about rendering from a noob

In this example, removing lines 44 or 46 makes the object stop rendering.

 43   function animate() {
 44     requestAnimationFrame( animate );
 45    renderer.render( scene, camera );
 46    controls.update();
 47   }

Shouldn’t renderer.render( scene, camera ) render the scene even without those lines?

You don’t need to call controls.update() at all. It’s sufficent to ensure that your camera looks at the scene position like so:

camera.lookAt( scene.position );

Codepen: https://codepen.io/anon/pen/PxoMdQ

And you have to call requestAnimationFrame( animate );, otherwise you have no animation loop and render your scene just once. If you perform just a single render, you should only do this when your model has finished loading:

Codepen: https://codepen.io/anon/pen/YRzmvV

1 Like

Thanks so much for the thorough explanation. You likely just saved me many hours of troubleshooting. :slight_smile:

1 Like