简体   繁体   中英

Why can't I load a .OBJ file into Python Ursina?

I am using the python Ursina engine. I want to import a.OBJ file, but it never works, yet no errors are raised. I have tried:

from ursina import *
from ursina.mesh_importer import *

app = Ursina()

model123 = load_model('model123.obj')
model123Entity = Entity(model=model123)
    
def update():
    move()

EditorCamera()
app.run()

I have also tried it without the.obj ending. Any help?

I have now tried:

from ursina import *
from ursina.mesh_importer import *

app = Ursina()

model123 = load_model(obj_to_ursinamesh('model123.obj'))
model123_Entity = Entity(model=model123)

app.run()

I get the error:

AttributeError: 'str' object has no attribute 'glob'
AL lib: (EE) ALCwasapiPlayback_mixerProc: WaitForSingleObjectEx error: 0x102

The issue is triangulation. The models faces must only be triangles. You can do this in Blender or other 3d software of that such type. I got this information thanks to Pokepetter on Github, at this issue .

For example, consider using Blender , or other software similar, to create your models and use the triangulate modifier on meshes to make them compatible with Ursina Engine.

Try using the triangulation modifier, which quickly sorts this. Subsequently, you must ensure that you export back to an .obj , however .blend files are supported by Ursina engine.

I am using the python Ursina engine. I want to import a.OBJ file, but it never works, yet no errors are raised. I have tried:

from ursina import *
from ursina.mesh_importer import *

app = Ursina()

model123 = load_model('model123.obj')
model123Entity = Entity(model=model123)
    
def update():
    move()

EditorCamera()
app.run()

I have also tried it without the.obj ending. Any help?

I have now tried:

from ursina import *
from ursina.mesh_importer import *

app = Ursina()

model123 = load_model(obj_to_ursinamesh('model123.obj'))
model123_Entity = Entity(model=model123)

app.run()

I get the error:

AttributeError: 'str' object has no attribute 'glob'
AL lib: (EE) ALCwasapiPlayback_mixerProc: WaitForSingleObjectEx error: 0x102

I am using the python Ursina engine. I want to import a.OBJ file, but it never works, yet no errors are raised. I have tried:

from ursina import *
from ursina.mesh_importer import *

app = Ursina()

model123 = load_model('model123.obj')
model123Entity = Entity(model=model123)
    
def update():
    move()

EditorCamera()
app.run()

I have also tried it without the.obj ending. Any help?

I have now tried:

from ursina import *
from ursina.mesh_importer import *

app = Ursina()

model123 = load_model(obj_to_ursinamesh('model123.obj'))
model123_Entity = Entity(model=model123)

app.run()

I get the error:

AttributeError: 'str' object has no attribute 'glob'
AL lib: (EE) ALCwasapiPlayback_mixerProc: WaitForSingleObjectEx error: 0x102

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM