0

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:

My player in Blender

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:

Result of my model

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?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
  • I don't understand what you mean by "armature". Since you have one model that works (the simple cube) and one that doesn't (your existing player) - what happens if you try gradually adding features to the working model, to make it more like the non-working one? When and where does that break? As for the error messages: what is your understanding of them? For example, do you understand what a "singular matrix" is, why graphics code would have to invert matrices, and why it causes a problem if the matrix is singular? Also, do you get any of these warnings with the cube? – Karl Knechtel Feb 18 '23 at 14:21
  • I edited the question to [remove noise](https://meta.stackoverflow.com/questions/343721) and to ask the question clearly and concisely. Please try to keep in mind that Stack Overflow is **not a discussion forum**. – Karl Knechtel Feb 18 '23 at 14:23
  • Thank you for your answer. I will try to look a little more when the problem arrives. And for my post, I thought it was important to put details. think it can be useful. – Jules Bourillon Feb 18 '23 at 14:47
  • It is useful and necessary to put details, which is why I have asked you for the specific details which are needed. I have not answered; I do not know how to use these tools, but I can give some advice on *how to ask a question properly on Stack Overflow*, so I did that. What I removed **is not considered** "detail" here. We do not care why you are trying to solve the problem, here, unless it's an especially strange problem. We do care about your attempt to *identify specifically where* the problem occurs. – Karl Knechtel Feb 18 '23 at 16:26

0 Answers0