Using Camera in task outside of main class

I created a Task class with a few small functions to facilitate creating the task itself to be loaded onto the Task Manager. They work fine unless I call the camera. For this reason I created a CameraTask sub class and which takes the window camera NodePath as an argument. Compiles just fine but I get an assertion failed in that class. Has anyone else worked with moving a task off of the main class involving the Camera?

What is the assertion you are seeing? Do you have some example code you can show? It shouldn’t mater where a camera is manipulated (e.g., ShowBase vs a task). The only special thing I know of with the Camera is that you have to disable the default camera control (base.disableMouse()) to be able to move the camera.

Hello,
A few notes this is C++ not Python.
My task is a simple Done::Status Enum function that once a frame proivdes the camera position.
Ther Assertion Failed gives line 993 of NodePath.cxx I believe.
Here is my task:
NodePath taskCamera;
CameraTask::CameraTask(NodePath tCamera)
{
this->taskCamera = tCamera;
}

Async::Task cameraTask(GenericAsyncTask* task, void* data)
{
cout << “Camera Pos:” taskCamera.get_pos() <<endl;
}

I know the Camera is getting passed corrected when I call the constructor above as I added a Pos check output there and it works.

I as well know the task is getting loaded on to the task manager just fine as when I do a simple cout it works like a dream.

Thanks,
Adam.

So I actually drew this out on paper. It appears the issue is caused the fact the Task cannot be made a member function of my class therefore when I try to call the camera which is a member object it cannot access it…
So a better question is there a way to make a Async::DoneStatus enum function a member function and then create a pointer to said member function to pass to the task manager…PHEW I think I stated it all.

I figure out what to do.

Since this is a member function and this class is to control the Camera it will be static across the entire Game. Therefore I set it up as a static reference and made the task itself a member function and passed it as such.