I want to use Panda3D’s resources as much as possible, but I have some difficulties with finding something I need.
My problem is: I want some function to be executed for example for every 15 seconds.
I want to ask if there is some method in Panda which receives delay time (15 seconds) and function which I need to be called every 15 seconds (something like Timer).
Hope I explained clearly. Thanks beforehand.
hi Alexandra and welcome aboard.
First thing to know is that the first valuable Panda3D resource for a beginner is the manual you find in this very site, look on the black topbar to find it. For your specific issue I bet you’ll find useful the two following links:
start with this
panda3d.org/manual/index.php/U … _the_Panda
and then this
Try to study them as well as you can and if you got again doubts then you may return here and post your new questions that eventually arises.
Actually, what you’re asking about sounds to me more like something the Task Manager can handle.
from direct.task import Task def yourMethod(task): #do stuff return task.again taskMgr.doMethodLater(delay, yourMethod, 'taskName')
For example, to have a print method occur every two seconds…
from direct.task import Task def printMethod(task): print ('2-second warning') return task.again taskMgr.doMethodLater(2.0, printMethod, 'printMethod')
https://www.panda3d.org/manual/index.php/Tasks - for the manual page.
Thanks a lot!!! This is it! I have read the manual about Intervals but it was not quite I wanted, but Task Manager is the solution for my problem! Thanks again.
ach, of course Xidram is right - I misjudged your question and assumed you missed to read the manual, a common oversight for newcomers - sorry Alexandra I’m becoming aged, try to understand anyway this got you the demonstration that here you can always find the right addressing for your P3D doubts and you won’t never left alone