Hey there, I'm using Godot 3.5.2, Windows 10.

I'm getting this error: ERROR: Condition "det == 0" is true. It also says: at: Transform2D::affine_invert (core\math\transform_2d.cpp:49) - Condition "det == 0" is true.

The line it refers to is: var _mouse_pos = get_viewport().get_mouse_position()

I'm working on a 2D adventure game.

It only happens sometimes. It doesn't cause a crash, but since it's a red error, I'd like to eliminate it.

Please help. Thanks!

  • xyz replied to this.

    Owl How do you know that's the line? Maybe post the whole script.

    • Owl replied to this.

      xyz That's the line it refers to when you click on the error (errors tend to refer to specific lines that trigger them).

      As for the function (the line in question is the first one):

      • xyz replied to this.

        Owl The line in the error you posted (49) does not refer to your script. It refers to Godot's C++ source code. Nothing in the line var _mouse_pos = get_viewport().get_mouse_position() would call Transform2D::affine_invert(). The error is somewhere else. Possibly in one of your functions called from _process().

        • Owl replied to this.

          xyz I didn't say "49" referred to my code. When I clicked on the error, it sends me directly to that line.

          • xyz replied to this.

            Owl Can you post a minimal reproduction project?

            • Owl replied to this.

              Can you print the value of the Transform2D immediately before that line?

              • Owl replied to this.

                xyz Not really, it's a whole game... I wouldn't know how to start trimming it down.

                I thought you were calling Transform2D::affine_invert(). It looks like I'm mistaken.

                • xyz replied to this.

                  DaveTheCoder Still, it's a good lead. Something somewhere has a zero scale transform. It's hard to determine what without seeing the broader context. So making a minimal reproduction project could help.

                  @Owl trim down bit by bit. Everything except that suspicious node can go, given that it still causes the error.

                  • Owl replied to this.

                    xyz I'll try and do that... probably tomorrow.

                    Additional info: I think it tends to happen (potentially always) when the game is running in the background for a while and I'm doing something else (like, tinkering in Audacity). It then may fire, usually in groups of 3's whenever it happens.

                    Okay, I know how to reproduce it 100% reliably: pressing Windows + D generates the red error. Every single time.

                    My friend speculates: "The reason for that is because what minimising the window does, is scale it into a small off-screen window."

                    • xyz replied to this.

                      Owl Do you have the latest 3.x build. If it's present there, it should be reported as an issue.

                      • Owl replied to this.

                        xyz I have 3.5.2. I'm assuming it's the latest one? Though I may have read version 3.6 also exists.

                          Owl As a quick test try to early exit the _process() if the window is minimized.

                          func _process(delta):
                          	if OS.window_minimized:
                          		return
                          	
                          	# the rest of it
                          • Owl replied to this.

                            xyz Sadly, still getting the error, but thanks for the input. I'll look into reporting it, though I can't say that I've reported anything before.

                            Cheers, I think I'll flag this thread as "solved" soon (if there is such a tag/flag) unless more input is given.

                            Owl I have 3.5.2. I'm assuming it's the latest one?

                            3.5.3-stable and 3.6-beta3 are the latest 3.x releases.