Animation not looping?

I have an animation set up that I want to start looping automatically when a model is loaded, however despite various combinations nothing is happening:

def __init__(self):

	    super().__init__(1000)

	    self.actor = Actor('low_poly_dragon.egg',{
		    'Idle':'low_poly_dragon-Idle.egg',
		    'Walk':'low_poly_dragon-Walk.egg',
		    'Run':'low_poly_dragon-Run.egg',
		    'Sprint':'low_poly_dragon-Sprint.egg',
		    'Flap':'low_poly_dragon-Flap.egg',
		    'Glide':'low_poly_dragon-Glide.egg'})
	
	    #not happening
	    self.actor.loop("Idle")

We’re going to need to see more code. Where are you instantiating your class? It may be that you’re not storing a reference to it and that the Actor object is therefore going out of scope, which will cause any animations playing to stop.

This is my full player script:

   class DragonPlayer(gameobject.GameObject):

       def __init__(self):

	       super().__init__(1000)

	       self.actor = Actor('low_poly_dragon.egg',{
		       'Idle':'low_poly_dragon-Idle.egg',
	  	       'Walk':'low_poly_dragon-Walk.egg',
		      'Run':'low_poly_dragon-Run.egg',
		       'Sprint':'low_poly_dragon-Sprint.egg',
		       'Flap':'low_poly_dragon-Flap.egg',
		       'Glide':'low_poly_dragon-Glide.egg'})
	
                  #####Ignore all this######
	       camera = base.camera
	       base.disableMouse()
	       camera.reparentTo(self.actor)
	       camera.setPos(self.actor, 0, 40, 30)
	       camera.setH(180)
	       camera.setP(-30)

	       shape = BulletBoxShape(Vec3(10, 10, 10))
	       bnode = BulletRigidBodyNode('Box')
	       bnode.setMass(self.mass)
	       bnode.addShape(shape)
	       self.actor.attachNewNode(bnode)

	       texture = loader.loadTexture('home_background.JPG')
	       self.actor.setTexture(texture)

	       self.actor.setPos(100,100,200)
	       self.actor.reparentTo(render)
                   ###############

	       #not happening
	       self.actor.loop("Idle")

and here’s where I instantiate it:

class World(ShowBase):

    def __init__(self):

	    ShowBase.__init__(self)

	    terrain = GeoMipTerrain("terrain")
	    terrain.setHeightfield("slice1.png")
	    terrain.setColorMap("texture.JPG")

	    terrain.setBlockSize(32)
	    terrain.setNear(100)
	    terrain.setFar(200)
	    terrain.setFocalPoint(base.camera)

	    root = terrain.getRoot()
	    root.reparentTo(render)
	    root.setSz(500)

	    terrain.generate()

	    def updateTerrainTask(task):

		    terrain.update()
		    return task.cont

	    taskMgr.add(updateTerrainTask, "terrain update")

	    self.LoadPlayer()           #### Here

	    def updatePhysics(task):

		    dt = globalClock.getDt()
		    worldPhysics.doPhysics(dt, 10, 1.0/180.0)
		    return task.cont

	    taskMgr.add(updatePhysics, "physics update")

	    self.accept("escape", sys.exit)

    def LoadPlayer(self):

	    player = DW_Dplayer.DragonPlayer()

So yeah, it’s as I said: you are nowhere storing a reference to the player object. So the moment that LoadPlayer returns, it is going to destroy that Actor since it’s not being kept around, which is only going to leave the underlying geometry (which is parented to the parent node).

Changing it to assign to self.player should fix this.

mind blown XD it’s working, thank you!