Dividing a vector by 0 creates a weird behavior in the debugger

Godot Version

v4.4.1.stable.official [49a5bc7b6]

I have a weird behavior in my game and then I have that:

Is this even possible? And if yes, in what circumstances?

Edit: Answer: I divided the Node position by 0. I keep this so if you ever end up in this very same situation you can understand it.

floating point numbers can be very low, while the editor may round the values to show 0.0 instead of 0.0000000001

Do not compare exact equality with them, you can use is_zero_approx if you must. More context would help apply a better solution to your situation.

Yep, that’s why I’ve compared it to 1 as the last (well first on the screenshot) example.

Context is simple: I have a Node that disappears weirdly. Luckily, it also takes the whole screen (don’t ask me how it can be visible, taking the whole screen, be rather small in size and not be visible on my screen). So I’ve connected to the gui_input signal of one of its child with a breakpoint in there and looked at the nodes values and found that. I’m puzzled (and this bug ate my day…).

New screenshot with is_zero_approx:

Not sure how checking positions being zero would help your example. You can set the node as “Top Level” if it’s parent node is moving it around, or make it a child of a CanvasLayer to remove the any Camera2D’s influence.

I finally found the answer: I divided my Vector by 0. It really generates weird behaviors to position a Node in infinity. It’s good to know (I think Godot should return some form of error).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.