Panda3D: Run a Function at Every Frame

Reminder: from direct.task import Task

OK. This and the next tutorial cover useful methods for animating your actors and scenes in Panda3D

If you want a function to be called at every frame, you add a task to the task manager.

taskMgr.add(Function, "FunctionName")

Where a task is a function defined as follows:

def Function(task):
  #do something...
  return Task.cont # use Task.done to stop the task

From the task argument task.time returns the time (in milliseconds I guess)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.