Hi! Why does everything disappear on window resize?
99.9% cases devtools serve the answer right away
That’s not it. https://codepen.io/QPL-Developer/pen/bNbbvvK
You may need to append the renderer.domElement (canvas) to a container that has some css classification as to what behaviour you need when the window resizes…
document.body.appendChild(renderer.domElement); doesn’t this do it?
Because you set camera.near = 10
in line 13 and the camera projection matrix is updated in the resize event handler, so you see the effect of the camera’s near only after resize.
My suggestion is to remove camera.near = 10
.
3 Likes
Thank you Pavel! That fixed it!
If your problem has been solved, please mark your question as solved… Give positive feedback to the one who took the time to look at your code.
1 Like