domethodlater using frames instead of seconds?

def shoot(self):
        if self.firing == 0 and self.playerBullets != 0:
            self.fire.start()
            self.firing = 1
            self.taskMgr.doMethodLater(.4, self.reset_fire, "reset fire")
            
            self.bullet = CollisionRay()
            self.bulletDummy = render.attachNewNode(CollisionNode("frowney"))
            self.bulletDummy.node().addSolid(self.bullet)
            base.cTrav.addCollider(self.bulletDummy, self.notifier)
            self.bulletDummy.show()
            if base.mouseWatcherNode.hasMouse():
                mpos = base.mouseWatcherNode.getMouse()
                self.bullet.setFromLens(base.camNode, mpos.getX(), mpos.getY())
            self.playerBullets = self.playerBullets - 

and I need to domethodlater in 1 frame so multiple collisions don’t render in the 100 or so frames per second.

Take a look here for using task. panda3d.org/manual/index.php/Tasks

Instead of using a domethodlater you might want to just use a taskMgr.add. Then you can return a Task.cont to run next frame?

Not really sure what you are trying to do here, but this should answer your question.

No, I don’t think that will work. See, I create a bullet object, and I need to remove it in the next frame.

Thanks.

In which case it seems as though it should do just what you want: have object creation and deletion happen in a single task, with a variable to hold any created objects, the contents of which are then destroyed at the start of the task (thus removing those created in the previous run of the task). You might then have some variable modified elsewhere to signal the creation of the object in the task. The only problem that I see offhand is that you might find object creation delayed by a frame, depending on how you detect the case that calls for creation of an object.

I think adding and removing a collider to a traverser is slow. You’d be better of creating the ray once, and setting a mask that will exclude the ray from colliding with anything, then, when you fire a bullet, set the rays mask to collide with walls, monsters, players and things like that.