Hi, I try to set clearColor using scene.clearColor = BABYLON.Color3(0.8, 0.8, 0.8); but Babylonjs render “ghost” frame. If I using builtin Color no problem. example: scene.clearColor = BABYLON.Color3.Gray;
You can reproduce in PG. Just open new PG and change clearColor.
For some reason re-setting the clearColor vector does a bit of magic. If you set the values instead (https://playground.babylonjs.com/#QN92LE#1) it works as expected. @sebavan - any idea where to start looking?
See next answer
Hi @kanyu, you forgot the ‘new’ keyword:
https://playground.babylonjs.com/#QN92LE#2
oh my, that was the problem? thanks! gosh, i should have noticed
Love it
Note that you should pass a Color4 as it is what clearColor expects.
Oh, great answer. Thank you @Gijs
I think Babylon should throw some errors because of assigning wrong type/parameter/Color etc…
Actually using typescript instead of js you would see the error at transpile time
We can not assert the types of all methods or the framework would be way to slow to run. And typings help a lot with that before runtime.
Oh! I see. That’s great.