Actor Animations not working but work in pview

Hi,

I’ve searched around the forums and seen the same problem for some but their fixes haven’t worked for me.

Basically I’ve got a model and animation that loads and plays fine in pview but doesn’t play in my game. The model loads fine and I get no error but loop() and play() just don’t work.

The problem could be that I have passed showBase into the class I load and loop() the animation so the syntax isn’t exactly the same as in the panda tutorial, could this be the problem?

Here is my code:

self.wolfActor = Actor("Animals/ArcticWolf/models/Wolf", 
                                {"walk" : "Animals/ArcticWolf/animations/Wolf_Walk"})
        self.wolfActor.reparentTo(self.showBase.render)
        self.wolfActor.setPos(0, 0, 0)
        self.wolfActor.loop('walk')

I also tried using the panda walking code from one of the earliest tutorials (just panda in the environment) but that doesn’t work in my game either, making me think it is something to do with passing showBase in.

Any ideas?

Thanks for your time,

Poncho

Don’t know if this is the problem you are experiencing or not, but make sure you keep a variable pointing to the Actor that will not get garbage collected. If it does then the Actor will sort of self destruct and turn into static geometry.

And you really should reparent the Actor to render, it is not intended to use showbase.render or something. As render is a global variable, this should not make problems in any case.

There’s no real difference. Only preference.

Agreed. “render is ShowBase.render” even evaluates to True in Python, so there really is no difference.

Although base.render is preferred, since this is much clearer.