'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera. error

My code is below:

enter image description here

This gives me the following error:

enter image description here

I cannot resolve this error can anyone help me out? Does it mean that perspectivecamera is no longer an instance of three.js library?



Solution 1:[1]

As pointed out in the comments, your code at line 24 is:

renderer.render(camera, scene)

Where camera is the first parameter, and scene is the second parameter. That is the incorrect order. So the variable scene is passed in place of camera.

Since scene is an instance of THREE.Scene, you get the error:

camera is not an instance of THREE.Camera

The correct code would be:

renderer.render(scene, camera)

Where scene is the first parameter, and camera is the second parameter.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anurag Srivastava