为什么我不能将 .OBJ 文件加载到 Python Ursina 中? [英] Why can't I load a .OBJ file into Python Ursina?

查看:50
本文介绍了为什么我不能将 .OBJ 文件加载到 Python Ursina 中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 python Ursina 引擎.我想导入一个 .OBJ 文件,但它永远不会工作,但没有引发错误.我试过了:

from ursina import *从 ursina.mesh_importer 导入 *app = Ursina()model123 = load_model('model123.obj')模型123实体=实体(模型=模型123)定义更新():移动()编辑器相机()应用程序运行()

我也试过没有 .obj 结尾.有什么帮助吗?

我现在已经尝试过:

from ursina import *从 ursina.mesh_importer 导入 *app = Ursina()model123 = load_model(obj_to_ursinamesh('model123.obj'))模型123_实体=实体(模型=模型123)应用程序运行()

我收到错误:

AttributeError: 'str' 对象没有属性 'glob'AL 库:(EE)ALCwasapiPlayback_mixerProc:WaitForSingleObjectEx 错误:0x102

解决方案

问题是三角测量.模型面只能是三角形.您可以在 Blender 或其他此类 3d 软件中执行此操作.感谢 Github 上的 Pokepetter,我在这个问题上获得了这些信息.

例如,考虑使用 Blender 或其他类似软件来创建您的模型,并在网格上使用 triangulate 修改器,使其与 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

解决方案

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.

这篇关于为什么我不能将 .OBJ 文件加载到 Python Ursina 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆