我正在尝试使用 Panda3D 用 Python 制作 3D 游戏。我使用 Blender 为播放器制作了一个 3D 模型,并为其添加了一些动画和绿色纹理。它看起来像这样:
然后我使用默认预设将它导出到 .gltf Embedded 中。
最后,我尝试使用这段代码来显示模型:
import panda3d.core as p3d
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
class Game(ShowBase):
def __init__(self, model_path):
ShowBase.__init__(self)
# Load my model
self.player = Actor(model_path)
# Add player to scene
self.player.reparentTo(self.render)
if __name__ == "__main__":
model_path = "player_model.gltf"
# Create the game instance
game = Game(model_path)
game.run()
然而,模型看起来完全不对:
我也收到这些警告:
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:Actor(warning): player_model.gltf is not a character!
:linmath(warning): Tried to invert singular LMatrix4.
:linmath(warning): Tried to invert singular LMatrix4.
...
:linmath(warning): Tried to invert singular LMatrix4.
我该如何解决这个问题?我导出模型的方式有问题吗?
我能够用相同的过程导入一个基本的立方体模型并得到预期的结果。问题可能是由骨架或动画引起的吗?