I want to call a function every frame so I used a task added to taskMgr.
But two variables defined in my main function is necessary in my task function, and I don’t know how to pass my parameters to it.
I’ve read some similar problem in forums but they are for python, using the “extraargs”,
but I find that C++ don’t have such parameter? is it? So I need help that how to pass my parameters defined in the main function to my task function.
Beside, I try to use global variable first to solve the problem but it went wrong, it’s another problem confused me.
If I do this PT(BulletWorld) physics_world; in my main function, it is ok;
but when I move it to out as a global variable, it triggered an exception. It seems I can’t use the PT(BulletWorld) physics_world as a global variable, although my global nodepath variables works well meanwhile.