I’m having two problems related to time. I suspect they might be related, but I’m far from sure of that.
First problem: I’m using Panda’s built-in framerate meter. On occasion, the framerate will be displayed as going above 60 FPS (up to around 80). Since my refresh rate is set to 60 and vsync is on (and it really is on… there’s no tearing), this isn’t logically possible. It seems to happen as a slingshot effect: I’ll do something graphically expensive which drops the framerate to pretty low for half a second then goes away, and as a result the framerate will go to 30-something, then 80, then back to 60.
Second problem: Framerate-independent motion seems to be awfully non-constant. Objects move with varying velocity even when they shouldn’t. As a minimal test, I’m doing this:
testobj = loader.loadModel('testmodel.egg')
testobj.reparentTo(render2d)
def test_update(task):
dT = globalClock.getDt()
testobj.setR(testobj.getR()+(dT*60))
return PandaTask.cont
taskMgr.add(test_update, 'test_update')
So, basically, the model should do one complete rotation every six seconds. Instead, its velocity jerks up and down every second or so, sometimes rotating twice as fast as other times.
Any idea on either of these? Other than getDt(), I’m not touching globalClock in any way.