not frame-based tasks?

Lets say you have a task that calls setPosHpr() on your node each 1/60 seconds, data read from some custom animation file format. If your game will lose focus (not render newer frames) and then resume, your animation controlled with the task will be out of sync with everyhting else, like Actor animations, it will resume exactly where it stopped in the last rendered frame.
So my question is, is there a way to make (doMethodLater) tasks not be dependent on frames? I know regular tasks are functions ran each frame, but I thought doMethodLater tasks, given a time interval, wouldn’t really need to stop when game window loses focus (doesn’t render newer frames).

You can try using a different Task Chain:
Task chains have a property named frameSync. If you create a new task chain to put your task in and disabled that property I think it will solve your problem.

or you can just pause all the animations when you lose focus.

You can also use Motion Paths:

but that would drastically change your program.

Also you sure this happens when your game lose focus? I would have thought this would only happen if the game was minimized.

It doesn’t seem to solve the issue. I also used 1 for numThreads.

Too expensive.

I think more would need pausing then that. And not sure how you could know when it happens.

You could :

accept('window-event', eventHandlerFunction)

and then in eventHandlerFunction, see if :


is false.