Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an Exception Error Caused in ursina's mouse.py #730

Open
cloud1980 opened this issue Oct 23, 2024 · 4 comments
Open

an Exception Error Caused in ursina's mouse.py #730

cloud1980 opened this issue Oct 23, 2024 · 4 comments

Comments

@cloud1980
Copy link

My Ursina application has runned normally for months on an Ubuntu 20.04 workstaion which can be visited by xrdp service. Sometimes the administrator uses the windows system's remote connector to check if it works well.
THe Ursina version is 5.2.0.
But today, one exception happed, maybe caused by "mouse" operation.
The info in the terminator are as follows:

Traceback (most recent call last):
File "/home/ndri/Crane_WenXiu/src/main.py", line 71, in
app.run()
File "/usr/local/lib/python3.8/dist-packages/ursina/main.py", line 241, in run
super().run()
File "/usr/local/lib/python3.8/dist-packages/direct/showbase/ShowBase.py", line 3330, in run
self.taskMgr.run()
File "/usr/local/lib/python3.8/dist-packages/direct/task/Task.py", line 553, in run
self.step()
File "/usr/local/lib/python3.8/dist-packages/direct/task/Task.py", line 504, in step
self.mgr.poll()
File "/usr/local/lib/python3.8/dist-packages/ursina/main.py", line 108, in _update
mouse.update()
File "/usr/local/lib/python3.8/dist-packages/ursina/mouse.py", line 234, in update
self._picker.traverse(self.traverse_target)
AssertionError: !cnan(r2) at line 181 of panda/src/mathutil/boundingLine.cxx

@pokepetter
Copy link
Owner

How can it be reproduced?

@cloud1980
Copy link
Author

The Ursina application has been running continuously for 24 hours a day without interruption for several months. Every one or two days, the administrator will remotely connect to check on it. This issue has only occurred once so far, so I also don’t know how to reproduce it.

The original code in "/usr/local/lib/python3.8/dist-packages/ursina/mouse.py", line 234 is

        if self.traverse_target:
            self._picker.traverse(self.traverse_target)

now I changed it as follows in order to catch some evidence:

        if self.traverse_target:
            try:
                self._picker.traverse(self.traverse_target)
            except Exception as e:
                print(e)

ChatGPT said "The expression !cnan(r2) shows that the code is checking whether the variable r2 is not a “Not-a-Number” (NaN) value. Variable r2 is NaN: cnan(r2) might be a function that checks whether r2 is NaN. If r2 is indeed NaN, then !cnan(r2) will fail, leading to an assertion error. You need to check whether there are any errors or unreasonable operations in the calculation process of r2 before the code reaches this line, such as division by zero, undefined mathematical operations, etc."

I suspect that the issue might be due to computational problems such as encountering a singular matrix that cannot be inverted during the pose transformation calculations for mouse operations, leading to this abnormal error.

@pokepetter
Copy link
Owner

This is probably a lower level error, in panda3d's collision library. There's some invalid math somewhere, like diving by 0 because something is scaled to 0 for example. It's kinda hard to figure out why it happens though.

@cloud1980
Copy link
Author

Running continuously from Oct 23 to Nov 25,a new error appeared.
It seems the error was also caused by the panda lib at a lower level.

Assertion failed: !cnan(r2) at line 181 of panda/src/mathutil/boundingLine.cxx
!cnan(r2) at line 181 of panda/src/mathutil/boundingLine.cxx
Assertion failed: !(pos.is_nan() || quat.is_nan() || scale.is_nan() || shear.is_nan()) at line 298 of panda/src/pgraph/transformState.cxx
:display(warning): Scene render has net scale (1 1 1); cannot render.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/direct/showbase/ShowBase.py", line 2158, in __igLoop
self.graphicsEngine.renderFrame()
AssertionError: !(pos.is_nan() || quat.is_nan() || scale.is_nan() || shear.is_nan()) at line 298 of panda/src/pgraph/transformState.cxx
:task(error): Exception occurred in PythonTask igLoop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants