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
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