0

I'm pretty new to programming with Python and am starting to learn how to use Ursina Game Engine...

Currently I'm running Python 3.9.4 through IDLE. I looked up a YouTube playlist that goes through different activities using Ursina. However I hit a snag with one of the videos. I keep receiving an Assertion Error even though I copied the code exactly as it is shown in the video.

Here is the complete Error I'm receiving:

= RESTART: C:/Users/Charbel/Desktop/Ursina Tutorials/smooth follow - flying dragon.py
package_folder: C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\ursina
asset_folder: C:\Users\Charbel\Desktop\Ursina Tutorials
blender_paths:
{'2.7': WindowsPath('C:/Program Files/Blender Foundation/Blender/blender.exe'),
 '2.8': WindowsPath('C:/Program Files/Blender Foundation/Blender 2.83/blender.exe'),
 'default': WindowsPath('C:/Program Files/Blender Foundation/Blender 2.83/blender.exe')}
screen resolution: (1366, 768)
size; LVector2f(1092, 614)
render mode: default
development mode: True
application successfully started
Traceback (most recent call last):
  File "C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\direct\showbase\ShowBase.py", line 2153, in __igLoop
    self.graphicsEngine.renderFrame()
AssertionError: !mat.is_nan() at line 322 of c:\buildslave\sdk-windows-amd64\build\panda\src\pgraph\transformState.cxx
Traceback (most recent call last):
  File "C:/Users/Charbel/Desktop/Ursina Tutorials/smooth follow - flying dragon.py", line 22, in <module>
    app.run()
  File "C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\ursina\main.py", line 238, in run
    super().run()
  File "C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\direct\showbase\ShowBase.py", line 3325, in run
    self.taskMgr.run()
  File "C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\direct\task\Task.py", line 546, in run
    self.step()
  File "C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\direct\task\Task.py", line 500, in step
    self.mgr.poll()
  File "C:\Users\Charbel\AppData\Roaming\Python\Python39\site-packages\direct\showbase\ShowBase.py", line 2153, in __igLoop
    self.graphicsEngine.renderFrame()
AssertionError: !mat.is_nan() at line 322 of c:\buildslave\sdk-windows-amd64\build\panda\src\pgraph\transformState.cxx

Here's a copy of my entire code:

from ursina import *

def update():
    global dy
    player.y += dy

    if abs(player.y)>= 3:
        dy = -dy
        
app = Ursina()

player = Entity(model='quad', scale=1, x = -4.5, texture = 'dragon_head.png')
e = [None]*50

e[0] = Entity(model='circle', scale = .2, color = color.green)
e[0].add_script(SmoothFollow(target = player, offset=(.3, 0, 0)))
dy =.08
for i in range(1,50):
    e[i] = Entity(model='circle', scale = .2, color = color.green)
    e[i].add_script(SmoothFollow(target = e[i-1], offset=(.2, 0, 0)))

app.run()

It appears that the error has something to do with the e[i-1] from my investigation. Has anyone else run into a similar issue or know if there's a bug in the Ursina language that causes this?

Thanks in advance

Charbel

  • 2
    Very strange. If I reduce the number of followers from 50 to 34, it works. If I increase it to 35, it starts breaking - but inconsistently when running repeatedly. It also works when I comment out the `e[i].add_script` line, execute it, uncomment the line and refresh the code with F5. This reeks of some invalid memory initialization in Panda3D, the underlying engine Ursina uses. – Jan Wilamowski Sep 24 '21 at 03:42
  • I know... it is very strange. I don't know why specifically that line is causing an issue. if I remove the for loop and insert each object of the list individually (i.e... e[0] to e[50]), it works. There is something specifically wrong with that line and it doesn't make sense. – Charbel Massoud Sep 25 '21 at 23:00

2 Answers2

1

My app just run to this error either.I think it is a rendering error caused by insufficient GPU computing power of the graphics.I reduce it to 44 and it works.

Vaughan
  • 11
  • 1
1

I'd assume either your computer or engine cannot handle it. I tried making a cube's rotation_z multiplied by an absurdly large number (100000000000000000000000000000000000000 to be exact) and it ran fine, but when I added an extra zero to the number, the engine broke.