I'm trying to use Panda3D to make a 3D game with Python. I used Blender to make a 3D model for the player, and gave it some animations and a green texture. It looks like this:
Then I exported it in .gltf Embedded, using default presets.
Finally, I tried using this code to display the model:
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()
However, the model looks completely wrong:
I also get these warnings:
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.
How can I fix the problem? Is there something wrong with how I am exporting the model?
I was able to import a basic cube model with the same process and got the expected result. Is the problem perhaps caused by armature or animations?