How to understand Vector3.project and NDC space

Okay, I think I might finally be onto something. Here’s a JSFiddle illustrating the problem I’m having. Notice that you can’t see the object in the scene until you click and drag on the canvas or do something else to move the OrbitControls. The console.log() of all the coordinates demonstrates the same thing as I’m seeing on my main project, but I also tried putting a console.log() of the projected coordinates inside the render loop (this makes the browser tab freeze if you let it run for longer than a few seconds, so be aware of that if you try it).

It turns out that before moving the OrbitControls, the projected coordinates look wrong, but after moving them, they actually align with what I would have expected them to be. So I think maybe this has something to do with the updating of the camera, which I thought should have been taken care of by those commands updating the camera, but maybe not? In the main project I’ve been working on I’ve had all of this code for projecting vectors outside the render loop, but I’m going to go back and try putting it inside the render loop and see if that works.

Side note, my main project doesn’t seem to have this issue that the JSFiddle has where the camera doesn’t actually look in the direction you pointed it until you move the OrbitControls. Not sure what’s going on there.