Playing animations without the direct module and class Actor

An example of how to play an animation without an actor class.

from direct.showbase.ShowBase import ShowBase

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

        model = loader.load_model("panda")
        model.reparent_to(render)

        anim = loader.load_model("panda-walk")

        #print(model.ls())
        #print(anim.ls())

        part_bundle = model.find('panda_soft').node().get_bundle(0)
        anim_bundle = anim.find('panda_soft-walk6-nurb-mod.egg').node().get_bundle()

        self.control = part_bundle.bind_anim(anim_bundle)
        self.control.loop(True)

app = MyApp()
app.run()

The description of what is happening here is told by drwr more competently than I am.

3 Likes