Timing and TimePerFrame

Hey Panda3D community!
I’m fairly new to panda3d and trying to wrap my head around the proper way to do timing, especially for simple things like movement.

I understand that I have a number of mechanisms like
globalClock.getDt(), globalClock.getFrameTime(), as well as task.time in Tasks.

From searching around in the forum it seems people tend to use globalClock.getDt() to determine the change.

What confuses me, is that the manual says this:
“gets the time (in seconds) since the last frame was drawn”

Wouldn’t then each method that relied on getDt get a slightly different time? Additionally, if I were using it for movement, wouldn’t you lose some time per frame after the getDt was called but before the frame was rendered?

Thanks for any help understanding.

Am I incorrect in the way I’m thinking about it, or, do people not mind the imprecision / have other ways of dealing with it.

If I needed more precision in time, would I have to do it myself?

– Kestred

[EDIT]
Additionally, are there any timing considerations for threaded TaskChains?

Hmm, that statement is inaccurate. It should say that getDt() “gets the time in seconds between the start of the current frame and the start of the frame before it.” So whenever you call getDt() within a given frame, it always returns the same value.

Threaded taskChains are a much more complex beastie. I strongly suggest working with single-threaded tasks until you are comfortable and familiar with the way all of the timing and threading mechanisms work in Panda.

David