RedHenDev / ursina_tutorials

MIT License
46 stars 66 forks source link

Chicken doesn't seem to spawn #30

Open AronicEbilond opened 2 months ago

AronicEbilond commented 2 months ago

I typed it in the comments section already, but I posted it here incase said comment gets deleted due to breaking youtubes TOS somehow. It can be seen on 2nd video in the tutorial playlist here;https://www.youtube.com/watch?v=-03rfhBZ8uY, and basically just, shares the code and some "possible" fixes I tried and all that. Most recently I even dowloaded the zip, yet even that somehow is not able to load the chicken and it has a totally different .obj file so https://imagetostl.com/convert/file/fbx/to/obj?status=expired#convert is probably not the problem.

Full error, as seen in copy of pyCraft_tut_2.py file here; PS C:\Users\lordo> & "C:/Program Files/Python312/python.exe" "c:/Users/lordo/OneDrive/.GD/D_Exe/py()'s/ursina_tutorials-main/ursina_tutorials-main/python_minecraft_tut_2021/pyCraft_tut_2.py" info: Using primary monitor: Monitor(x=0, y=0, width=1920, height=1080, width_mm=344, height_mm=193, name='\\.\DISPLAY1', is_primary=True) :prc(warning): Invalid integer value for ConfigVariable win-size: 864.0 :prc(warning): Invalid integer value for ConfigVariable win-size: 1536.0 Known pipe types: wglGraphicsPipe (3 aux display modules not yet loaded.) set window position: Vec2(192, 108) :prc(warning): changing default value for ConfigVariable paste-emit-keystrokes from '1' to '0'. :pnmimage:png(warning): iCCP: known incorrect sRGB profile package_folder: C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina asset_folder: c:\Users\lordo\OneDrive.GD\D_Exe\py()'s\ursina_tutorials-main\ursina_tutorials-main\python_minecraft_tut_2021 read obj at: c:\Users\lordo\OneDrive.GD\D_Exe\py()'s\ursina_tutorials-main\ursina_tutorials-main\python_minecraft_tut_2021\assets\minecraft-chicken\source\chicken.obj Traceback (most recent call last): File "C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina\mesh.py", line 90, in _set_array_data vmem[:] = a


ValueError: memoryview assignment: lvalue and rvalue have different structures

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\lordo\OneDrive\.GD\D_Exe\py()'s\ursina_tutorials-main\ursina_tutorials-main\python_minecraft_tut_2021\pyCraft_tut_2.py", line 129, in <module>  
    chickenModel = load_model('chicken.obj')
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina\mesh_importer.py", line 79, in load_model
    m = obj_to_ursinamesh(path=path, name=name, return_mesh=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina\mesh_importer.py", line 375, in obj_to_ursinamesh
    return Mesh(
           ^^^^^
  File "C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina\mesh.py", line 69, in __init__
    self.generate()
  File "C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina\mesh.py", line 183, in generate
    self._set_array_data(vdata.modify_array(uv_attribute_index), self._ravel(self.uvs), 'f')
  File "C:\Users\lordo\AppData\Roaming\Python\Python312\site-packages\ursina\mesh.py", line 92, in _set_array_data
    raise Exception(f'Error in Mesh. Ensure Mesh is valid and the inputs have same length: vertices:{len(self.vertices)}, triangles:{len(self.triangles)}, normals:{len(self.normals)}, colors:{len(self.colors)}, uvs:{len(self.uvs)}')
Exception: Error in Mesh. Ensure Mesh is valid and the inputs have same length: vertices:264, triangles:0, normals:264, colors:0, uvs:264

And, yeah, its possibly just an issue with my installation of python, but I am unsure... An error is an error, with or without my computer's installation being the culprit I say.
AronicEbilond commented 2 months ago

P.S. Copy of the code from OG YT comment incase something happens + slightly modified it for fun to make sprinting easier for me :) + also including console log things(not errors, but certainly could explain why the chicken refuses to display itself + admittedly, if there's a solution later on in that 2nd part, I kinda stopped watching past that point... as of posting these).

"

https://www.youtube.com/watch?v=vX4l-qozib8

https://www.youtube.com/watch?v=-03rfhBZ8uY

from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController from numpy import floor from perlin_noise import PerlinNoise

app = Ursina()

window.color = color.rgb(0,200,211) window.exit_button.visible = False window.fps_counter.enabled = False window.fullscreen = False window.show_ursina_splash = False

scene.fog_color = color.rgb(1,1,0) scene.fog_density = 0.1

browntile = load_texture('browntile_w_highlighted_outline.png') dirtybrowntile = load_texture('browntiledirty - combined.png')

def input(key): if key == 'escape': quit() if held_keys['q']: subject.speed = 12 else: subject.speed = 6

def update(): pass

terrain = Entity(model=None, collider=None) noise = PerlinNoise(octaves=1, seed=2021) amp = 6 freq = 12

terrainwidth = 50 for i in range(terrainwidth*terrainwidth):

bud = Entity(model='cube', color=color.white, position=(0,0,0), scale=(1,1,1))
bud.x = floor(i/terrainwidth)
bud.z = floor(i%terrainwidth)
bud.y = floor((noise([bud.x/freq,bud.z/freq])* amp))
bud.parent = terrain

terrain.combine() terrain.collider = 'mesh' terrain.texture = browntile

subject = FirstPersonController() subject.cursor.texture = 'customcursor1.png' subject.cursor.rotation = (0,0,0) subject.cursor.scale = 0.05

subject.speed = 6

subject.gravity = 1.25 subject.x = subject.z = 5 subject.y = 12

chickenModel = load_model('chicken.obj') vincent = Entity(model=chickenModel, scale=1, #model, NOT load_model again! x=22, y=16, z=7.1, texture='chicken.png', double_sided=True)

app.run() "

Messages received from terminal; " set fullscreen to False ---------------set size to: Vec2(1536, 864) set window position: Vec2(192, 108) read obj at: c:\Users*\OneDrive.GC\C_Exe(Games)\Ursina-Engine\PyCraft - Red Hen Dev\assets\minecraft-chicken\chicken.obj saved .bam to: c:\Users*\OneDrive.GC\C_Exe(Games)\Ursina-Engine\PyCraft - Red Hen Dev\models_compressed\chicken.bam os: Windows development mode: True application successfully started info: changed aspect ratio: 1.778 -> 1.778 :display:windisplay(warning): Could not find icon filename textures/ursina.ico "

I wonder if ursina.ico is perhaps at fault? Also here's the block texture I made from a screenshot of the sodium chloride meme cause I'm special browntile_w_highlighted_outline

AronicEbilond commented 2 months ago

Silly thing is, when I tried to install aux, "pip install aux", I wasn't able to because of, what was claimed to be, not an issue with "pip", but an issue with a subprocess? Could be related. The first error I showed her, did say something about aux rendering or whatever... although that's audio, so it could very well be that the chicken model DID render, but its just invisible.