The Worlds simplest animation fails!

Maybe someone can tell me where I am going wrong?

Step 1:

We start by creating a fresh Blender
default cube, I erased the camera and the light,
no texture on the cube no material nothing.

Swith to animation tab, non-linear animation …

Step 2:

Animate the cube, by inserting keyframes

Step 3:

Export the model as a .gltf
GLTF Panda3D docs

Step 4:

We can validate the .gltf, make sure it is good,
it is as simple as ‘drag & drop’
(Khronos is the organisation responsible for maintaining the standard)
Khronos gltf-validator

Step 5:

We can even take it a step further and see the model
in a .gltf ‘previewer’ online
gltf-viewer
another gltf viewer

Step 6:

Everything seems to be going well
our hopes and dreams are flying high…
Life is good, the sun is shinning

#!/usr/bin/env python3

"""
Simple cube animation
"""

import sys
from panda3d.core import load_prc_file_data
from direct.showbase.ShowBase import ShowBase
from panda3d.core import load_prc_file_data

# Set verbosity level to debug
#load_prc_file_data("", "notify-level debug")

class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        # Quit game with escape key
        self.accept('escape', sys.exit)

        # Disable the camera trackball controls
        self.disableMouse()
        self.camera.setPos(0, -10, 0)

        # Load the glTF model
        self.actor = self.loader.loadModel("cube.gltf")
        self.actor.reparentTo(self.render)

        # Find the animation named "anim1" and store it
        self.animation = self.actor.find('**/+AnimBundleNode').node().getAnim('anim1')

        # Set up key event to trigger animation
        self.accept('a', self.playAnimation)

    def playAnimation(self):
        # Check if animation is already playing, if so, stop it
        if self.animation.isPlaying():
            self.animation.pause()
        else:
            # Play the animation
            self.animation.play()

if __name__ == "__main__":
    app = MyApp()
    app.run()

The simplest script I can think of!

Errors crashes Doom, sadness, desparation.
I just want to make a freakin’ cube spin.
I’ve been at this for months!

There is a small hole inside of me, where my soul used to be :frowning:

This is for a ‘Actor’ but what if I want to animate a draw bridge in the scene for example
is that still a actor?

Let me know if you guys spot my error. Thanx <3

Youtube Ressources:

Prospero Has a great Series!

Outstanding video animating landing gear

Official Khronos, 1 hour conference on GLTF file format

I think you should familiarize yourself with this table, what you are trying to do is called object animation. Object animation in panda is possible, but only requires a specific exporter, which is not currently available. As a solution, you can use a skin animated with bones, that is, skeletal animation.

https://docs.panda3d.org/1.10/python/pipeline/model-file-formats#supported-feature-table

1 Like

I was trying with bones before, had issues as well.
not software limitation just my abilities with Blender.

Thank you for this it helps a lot,

im gonna go watch some more tutorials:

Game Development in Python 3D Model Skeleton Animation with Blender Part 3

Animating objects with bones is very simple, just assign a skin modifier and set the fixed weight to 1.

1 Like