FPSCameraSceneNode Frame independent?
FPSCameraSceneNode Frame independent?
Hello,
I've got a problem with my FPSCamerascene node.
The higher my framerate is the higher my player jumps. I don't know how I can fix this problem because I can't change the "Jump-speed" at runtime...
someone got an idea whats to do?
Maybe someone had written an own fps camera which is better than the "onboard" FPS camera node of irrlicht?
sorry for my bad english, I'm german.
I've got a problem with my FPSCamerascene node.
The higher my framerate is the higher my player jumps. I don't know how I can fix this problem because I can't change the "Jump-speed" at runtime...
someone got an idea whats to do?
Maybe someone had written an own fps camera which is better than the "onboard" FPS camera node of irrlicht?
sorry for my bad english, I'm german.
There are .h and .cpp files that contains FunCollision itself. They are needed to be able to use my collision system.
The rest of the .h and .cpp files are not really needed, however, they can ease your life if you want to use FC.
And yes, these are a bit different from one tutorial to the other. For example, the CGameCamera files. Why?
Because in one of the tutorials, you can only fly around.
In the other one, there is gravity and you can jump, too.
In another one, you can do even more things.
All of them have many comments that explains everything.
Ah, now I see. You can only use these functions (and the camera) what I've been talking about, if you include FC in your project. Sorry.
The rest of the .h and .cpp files are not really needed, however, they can ease your life if you want to use FC.
And yes, these are a bit different from one tutorial to the other. For example, the CGameCamera files. Why?
Because in one of the tutorials, you can only fly around.
In the other one, there is gravity and you can jump, too.
In another one, you can do even more things.
All of them have many comments that explains everything.
Code: Select all
I just want to add your camera of your engine into my project but I don't really know how to do this
OK, at the moment I'm trying to include the CGameCamera.h into my project to use this camera class but I've got a problem with the Function
Everytime I compile my code, it shows me an "undefined reference" to this Function, I don't know what I have to do. I know, I replaced the CGameInput with a IEventReceiver but the error comes too when I replace my EventReceiver with the CGameInput...
Code: Select all
CGameCamera* camera = new CGameCamera(device, cmgr, getEventReceiver(),
core::vector3df(50, 70, -60), // set it's position
core::vector3df(30, 50, 30), // set it's shape
core::vector3df(0, 30, 0)); // set the "head" position
Hi!
A) Did you copy and include CGameCamera.h and CGameInput.h into your project? Undefined reference means that it cannot find the function or variable.
B) What does "getEventReceiver()" do in your project? I suggest to use CGameInput.h and .cpp first and swith to another event receiver later if it works.
C) Can you compile any of the tutorials I've made? If not, there must be some other error I haven't bumped into yet.
D) If your code is not too long, you can send it to me, I'll make it run. (But I use Code::Blocks with MinGW).
Cheers,
PI
A) Did you copy and include CGameCamera.h and CGameInput.h into your project? Undefined reference means that it cannot find the function or variable.
B) What does "getEventReceiver()" do in your project? I suggest to use CGameInput.h and .cpp first and swith to another event receiver later if it works.
C) Can you compile any of the tutorials I've made? If not, there must be some other error I haven't bumped into yet.
D) If your code is not too long, you can send it to me, I'll make it run. (But I use Code::Blocks with MinGW).
Cheers,
PI
PI wrote:Hi!
A) Did you copy and include CGameCamera.h and CGameInput.h into your project? Undefined reference means that it cannot find the function or variable.
I copied the files in the right directory and Included them.
With this function I get the pointer to the eventReceiver ( I use the MasterEventReceiver for my project)B) What does "getEventReceiver()" do in your project? I suggest to use CGameInput.h and .cpp first and swith to another event receiver later if it works.
Yes, I can.C) Can you compile any of the tutorials I've made? If not, there must be some other error I haven't bumped into yet.
About 4000 Lines of code is much too long I thinkD) If your code is not too long, you can send it to me, I'll make it run. (But I use Code::Blocks with MinGW).
cyaCheers,
PI
[EDIT]
Ok, I found the "bug" I forgot to add the Includes into my project
I decided to switch completely to you EventReceiver because you Receiver looks more dynamic and it's more compitable to your camera etc.
So you've found the bug? Coolness
You can use any type of event receiver. As you can see, it's only needed when passing it's pointer to the camera, and the camera just checks if up/down/left/right is pressed or not.
Oh yeah and one more thing. It also locks the mouse to the center of the screen which is needed for relative mouse positions, so that you can rotate the view with the mouse.
This is the
"input->setLockMouse(true); // lock mouse to the center of the screen"
function.
But if your event receiver knows all of these, you can change to yours easily.
You can use any type of event receiver. As you can see, it's only needed when passing it's pointer to the camera, and the camera just checks if up/down/left/right is pressed or not.
Oh yeah and one more thing. It also locks the mouse to the center of the screen which is needed for relative mouse positions, so that you can rotate the view with the mouse.
This is the
"input->setLockMouse(true); // lock mouse to the center of the screen"
function.
But if your event receiver knows all of these, you can change to yours easily.
Well, I might not understand you completely, so here's an example:
Say I have a terrain, a house, and a couple of crates outside, ok?
I create the terrain scene node, and then a terrain selector for it.
Then I add an object that is binded to this selector, and to this node.
I load the house model and create an octree selector for it.
Then I add an object that is binded to this selector, and to this node.
I load the crate model and create one box selector for it (bbselector). Then I clone the crate scene node e.g. 10 times (crateSceneNode), and in the meantime, I also add them as collision objects. Like here:
cmgr->addObject(bbselector, crateSceneNode);
Okay, now I want to add 3 characters (for example animated dwarfs). If they have the same size, mass, etc. etc. I create one sampler (dwarfSampler), and share between them.
cmgr->addEntity(core::vector3df(-150,-66, -40), dwarfSampler, dwarf1);
cmgr->addEntity(core::vector3df(-150,-66, -80), dwarfSampler, dwarf2);
cmgr->addEntity(core::vector3df(-150,-66, -120), dwarfSampler,dwarf3);
But if I also want to add an elf character (who's taller) I create an ellipsoid sampler for it (elfSampler), and cmgr->addEntity(pos, elfSampler, elfNode);
A meta triangle selector in Irrlicht is "multiple triangle selectors work as one big selector". Here, everything is automatic, you don't have to deal with meta triangle selectors.
Just use cmgr->addObject() and cmgr->addEntity() commands, and don't forget to call cmgr->update(elapsedTime); in your main loop every frame.
I hope I've answered your question
Say I have a terrain, a house, and a couple of crates outside, ok?
I create the terrain scene node, and then a terrain selector for it.
Then I add an object that is binded to this selector, and to this node.
I load the house model and create an octree selector for it.
Then I add an object that is binded to this selector, and to this node.
I load the crate model and create one box selector for it (bbselector). Then I clone the crate scene node e.g. 10 times (crateSceneNode), and in the meantime, I also add them as collision objects. Like here:
cmgr->addObject(bbselector, crateSceneNode);
Okay, now I want to add 3 characters (for example animated dwarfs). If they have the same size, mass, etc. etc. I create one sampler (dwarfSampler), and share between them.
cmgr->addEntity(core::vector3df(-150,-66, -40), dwarfSampler, dwarf1);
cmgr->addEntity(core::vector3df(-150,-66, -80), dwarfSampler, dwarf2);
cmgr->addEntity(core::vector3df(-150,-66, -120), dwarfSampler,dwarf3);
But if I also want to add an elf character (who's taller) I create an ellipsoid sampler for it (elfSampler), and cmgr->addEntity(pos, elfSampler, elfNode);
A meta triangle selector in Irrlicht is "multiple triangle selectors work as one big selector". Here, everything is automatic, you don't have to deal with meta triangle selectors.
Just use cmgr->addObject() and cmgr->addEntity() commands, and don't forget to call cmgr->update(elapsedTime); in your main loop every frame.
I hope I've answered your question
Yes that helped me a lot! Thank you ^_^
Now I've got a bigger problem
When I run my program (with debugger) the debugger gives me the message: "SIGSEGV - Segmentation Fault" in the line:
In the function
I really don't know whats to do... segmentation fault is , if I'm right, an memory acess error, I hope you can help me ._.
Now I've got a bigger problem
When I run my program (with debugger) the debugger gives me the message: "SIGSEGV - Segmentation Fault" in the line:
Code: Select all
camPos = cam->getAbsolutePosition();
Code: Select all
CGameCamera::update()