FPSCameraSceneNode Frame independent?
I guess we both will be happy if we finally manage to get this work
So segmentation fault... I guess somewhere you've called "cam->drop();" or "delete cam;" or maybe it's not even created
"cam = smgr->addCameraSceneNode();" (in the constructor of CGameCamera).
Or, at when getting rid of the garbage. Watch the order! If you have created:
1. A device
2. A timer
3. A collision manager
4. An event receiver
5. A camera
Then you should release them in reverse order:
5. if (camera) delete camera;
4. if (input) delete input;
3. if (cmgr) delete cmgr;
2. if (timer) delete timer;
1. device->drop();
So segmentation fault... I guess somewhere you've called "cam->drop();" or "delete cam;" or maybe it's not even created
"cam = smgr->addCameraSceneNode();" (in the constructor of CGameCamera).
Or, at when getting rid of the garbage. Watch the order! If you have created:
1. A device
2. A timer
3. A collision manager
4. An event receiver
5. A camera
Then you should release them in reverse order:
5. if (camera) delete camera;
4. if (input) delete input;
3. if (cmgr) delete cmgr;
2. if (timer) delete timer;
1. device->drop();
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
You saw a piece of code (first post )
I think the problem is the class... it seems that some the private variables never get declared or they don't get a value... because for example the variables
Which are all privates out of your class aren't aviable in the CGameCamera::update() function but the compiler doesn't say something about it. But when one of the variables get changed or comething the whole game chrashes and the debugger shows me the Error Message which I wrote a few posts earlier.
Whats the problem? I didn't change anything on your class and I use the class same as in your examples...
I think the problem is the class... it seems that some the private variables never get declared or they don't get a value... because for example the variables
Code: Select all
core::vector3df camPos;
core::vector3df camRot;
vector3df camForward;
vector3df camLeft;
float runSpeed;
float jumpStrength;
vector3df camUp;
Whats the problem? I didn't change anything on your class and I use the class same as in your examples...
The short answer is: I don't know.
So you're sure you've got a collison manager created and passed it's pointer to the camera class, you've also created the camera and all the collision objects and entities has scene nodes associated with them, and you didn't delete any pointers until the end of your program, and blahblahblah...
See, if there would be something wrong in the tutorials, you wouldn't be able to compile or to run them without a crash, so I can only suggest you to go back to the tutorials, and see why they work and yours why not.
Edit: did you pass a valid pointer of your IrrlichtDevice to the collision manager?
So you're sure you've got a collison manager created and passed it's pointer to the camera class, you've also created the camera and all the collision objects and entities has scene nodes associated with them, and you didn't delete any pointers until the end of your program, and blahblahblah...
See, if there would be something wrong in the tutorials, you wouldn't be able to compile or to run them without a crash, so I can only suggest you to go back to the tutorials, and see why they work and yours why not.
Edit: did you pass a valid pointer of your IrrlichtDevice to the collision manager?
-
- Posts: 758
- Joined: Mon Mar 31, 2008 3:32 pm
- Location: Bulgaria
I believe he`s getting trouble because he`s trying to extract only the camera and use some different collision system. Somehow not getting my sympathy.
By the way, PI, I`m sending you an email in a while- writing it right now.
By the way, PI, I`m sending you an email in a while- writing it right now.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
-.- I forgot to Include the declarations-file of my global variables like the camera etc to "CGameCamera.h" and the "CCollManager.h".
Now - I think one of the last - problems is:
I get the error message :
The "CGameCamera.h" and the "CGameTimer.h" are same like in your examples.
Now - I think one of the last - problems is:
I get the error message :
In the LinesDebugger wrote:expected initializer before "*" token
Code: Select all
extern CGameCamera* camera_class;
//and
extern CGameTimer* gameTimer;
This should work:
Or this:
Code: Select all
// to your globals.h
#include "FunCollision.h"
using namespace COLL; // did you wirte this line too?
#include "CGameTimer.h"
#include "CGameCamera.h"
CCollManager* cmgr;
CGameCamera* camera;
CGamerTimer* timer;
Code: Select all
// to your globals.h
#include "FunCollision.h"
// Forward declaration:
class CGameCamera;
class CGameTimer;
COLL::CCollManager* cmgr;
CGameCamera* camera;
CGamerTimer* timer;
Somewhere (over the rainbow) the relative mouse positions are not set to zero.
This might happen if you've forgotten to call:
"input->setLockMouse(true); // lock mouse to the center of the screen"
before (or inside) your mail loop (in the very beginning of it).
Or, maybe, in your camera.update():
"
// ----- Camera rotation:
s32 rmx = 0, rmy = 0; // they should be zero, but it might not matter (?)
input->getRelMousePos(rmx, rmy);
"
Cheers,
PI da HERO
This might happen if you've forgotten to call:
"input->setLockMouse(true); // lock mouse to the center of the screen"
before (or inside) your mail loop (in the very beginning of it).
Or, maybe, in your camera.update():
"
// ----- Camera rotation:
s32 rmx = 0, rmy = 0; // they should be zero, but it might not matter (?)
input->getRelMousePos(rmx, rmy);
"
Cheers,
PI da HERO