ERROR:SCRIPT: builtins/render/default.render_script:176: argument #1 contains one or more values which are not numbers: vmath.matrix4(nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, 0, 0, 0, 1)
stack traceback:
[C] in function set_view
builtins/render/default.render_script:176: in function <builtins/render/default.render_script:156>
You’ve set a very small scale value on the z-component of your player, and since you also have the camera as a child of the player the scale will be inherited and it will cause problems when calculating the view projection since the z-value is involved in the calculation:
The camera view and projection is calculated based on the camera properties such as near and far z planes, fov and so on. The camera transform (ie position, rotation and scale) are also used in the calculation of the view and projection. A z value of 0.000001 is very small and the final calculation of the projection matrix will not give you valid values. I can’t give you the exact reason but it’s bound to be rounding and math precision issues of some kind.
Set the z value of your camera game object to 1. Does it have to be 0.000001? If so, why?
It’s a common thing with computers and floating point values.
They don’t have infinite precision, and sooner or later they may very well be something other than what is expected, due to rounding errors.
And once those rounding errors accumulate, there’s even more risk that the value may get rounded to something you didn’t expect, or the calculations didn’t accept.
In this case, it’s likely it (eventually) got rounded to something close to zero, which was invalid for a calculation. In those cases, you get a NaN which stands for Not A Number. At that point, any further calculations won’t work, and will just produce more NaN’s.
Here’s a video of how it may appear in other scenarios, when the NaN spreads through calculations.