New camera class trouble.
Posted: Mon Jun 09, 2008 12:59 am
Hi, I've been trying to write my own camera class but have run into an issue that I am unsure how to resolve.
The real problem I'm having is that OnAnimate isn't being called. I used the FPSCamera as a model since what I'd like to create is similar (Hence referencing OnAnimate).
In order to narrow the list of what could cause the problem in my camera, I decided to copy the source code for CCameraSceneNode and CCameraFPSSceneNode into my own files and try to add an FPS camera like so:
(FPSCamera is my class name for the CCameraFPSSceneNode code)
FPSCamera camera = new FPSCamera(0, smgr, device->getTimer(),
device->getCursorControl(), -1,
100.0f, 300.0f, 0.f,
0, 0, true );
smgr->setActiveCamera(camera)
You'll notice that I pass device->getTimer() into the constructor. I added this because the source for CCameraFPSSceneNode uses os::Timer::getTime(), which I do not have access to. I therefore simply added a member variable pointer to ITimer and set it to device->getTImer(). (this doesn't matter since OnAnimate() isn't getting called anyway).
I've come to the conclusion that the difference between my code and just using the built-in addCameraSceneNodeFPS() is that CSceneManager passes 'this' into parent if none is set. My problem is, I can't pass my pointer to the SceneManager, since it is of type ISceneManager, which does not inherit from ISceneNode, whereas CSceneManager does. Perhaps I am missing something here, but that's the only cause I could come up with for why my camera renders everything fine, but won't move.
Any help would be greatly appreciated. I'd also like to know if ISceneManager not inheriting from ISceneNode was intentional, and if so, was curious as to what the reason was.
Thanks in advance.
The real problem I'm having is that OnAnimate isn't being called. I used the FPSCamera as a model since what I'd like to create is similar (Hence referencing OnAnimate).
In order to narrow the list of what could cause the problem in my camera, I decided to copy the source code for CCameraSceneNode and CCameraFPSSceneNode into my own files and try to add an FPS camera like so:
(FPSCamera is my class name for the CCameraFPSSceneNode code)
FPSCamera camera = new FPSCamera(0, smgr, device->getTimer(),
device->getCursorControl(), -1,
100.0f, 300.0f, 0.f,
0, 0, true );
smgr->setActiveCamera(camera)
You'll notice that I pass device->getTimer() into the constructor. I added this because the source for CCameraFPSSceneNode uses os::Timer::getTime(), which I do not have access to. I therefore simply added a member variable pointer to ITimer and set it to device->getTImer(). (this doesn't matter since OnAnimate() isn't getting called anyway).
I've come to the conclusion that the difference between my code and just using the built-in addCameraSceneNodeFPS() is that CSceneManager passes 'this' into parent if none is set. My problem is, I can't pass my pointer to the SceneManager, since it is of type ISceneManager, which does not inherit from ISceneNode, whereas CSceneManager does. Perhaps I am missing something here, but that's the only cause I could come up with for why my camera renders everything fine, but won't move.
Any help would be greatly appreciated. I'd also like to know if ISceneManager not inheriting from ISceneNode was intentional, and if so, was curious as to what the reason was.
Thanks in advance.