Skip to content Skip to sidebar Skip to footer

React Three Js Scene Wont Render Until Manipulated In Chrome Inspector Extension

I am trying to get three js in my react app. After copying my existing three js code to react it did not work at first. I made a question for that here. Right now I have simplified

Solution 1:

I found the breaking piece of code. For some reason camera.lookAt(scene) messes everything up. When this is removed everything renders fine.

The code I was moving was from a Threejs r84 non react app to a React 16.2 with Threejs r89 app.

Which means this was probably an upgrading error as camera.lookAt(scene) worked in the old app. Looking at the threejs docs, lookAt takes a Vector so changing the code to camera.lookAt(scene.position) also fixes the problem.

Post a Comment for "React Three Js Scene Wont Render Until Manipulated In Chrome Inspector Extension"