3rd Person Camera
i did this sorta, but mine isn't the best way i'm sure...
i just set the cam up a certain distance from the character then bound it to the player by making their scenenode the parent of the camera, the trouble is i have to keep resetting the camera target every time the player moves, and that causes wierd jitters if the framerate isnt high enough.(these are most offensive when seen in fullscreen mode) i think the sceneNode Animator thinger is a good idea, just to smoothe it out, so not every little bounce and jitter the character makes is reflected by the camera. i almast want it to be so that i can give the camera a "threshhold" so that unless the player moves > a certain distance the cam stays where it is...
-Ted
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
qwe, you just gave me an interesting idea.
what if the camera was as you described. a seperate agent, which merely tried to keep the player in view. With its own 'breathing'-- perhaps it could try stalking the player too-- watching him from the rooftops, jumping from ledge to ledge.
then half way thru the game, a plot-twist. the game switches to first person, and you find out that there really is something stalking the player, and you've merely been seeing thru its eyes. some sort of shade, or demon. then he has to fight it. lol, im weird I know.
what if the camera was as you described. a seperate agent, which merely tried to keep the player in view. With its own 'breathing'-- perhaps it could try stalking the player too-- watching him from the rooftops, jumping from ledge to ledge.
then half way thru the game, a plot-twist. the game switches to first person, and you find out that there really is something stalking the player, and you've merely been seeing thru its eyes. some sort of shade, or demon. then he has to fight it. lol, im weird I know.
a screen cap is worth 0x100000 DWORDS
not wierd, imaginative
naw dude, thats not wierd, its really cool!
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Cool idea Keless..
Buhatkj: You aren't supposed to set the player as the parent. The camera should have no parent node.
Qwe: Cool idea. I think it would fit more into my TR cam when I get it working. The first version of the TR I release will have smooth acceleration for rotation, and perhaps it won't be too hard to work in smooth acceleration for movement as well..
The TR cam will be basic at first, but there's a whole lot that could be added to it: Points of Interest to try to keep in camera view (eg a point around a corner), other nodes to try to, or always, keep in view (eg current target enemy), probably a bunch of other things.
The Breathing/Jittering would be best as an additional animator which could be attached to the camera after the base animator is. I think this would provide the best separation of code and you could put it on other nodes in your game as well if you want.
Buhatkj: You aren't supposed to set the player as the parent. The camera should have no parent node.
Qwe: Cool idea. I think it would fit more into my TR cam when I get it working. The first version of the TR I release will have smooth acceleration for rotation, and perhaps it won't be too hard to work in smooth acceleration for movement as well..
The TR cam will be basic at first, but there's a whole lot that could be added to it: Points of Interest to try to keep in camera view (eg a point around a corner), other nodes to try to, or always, keep in view (eg current target enemy), probably a bunch of other things.
The Breathing/Jittering would be best as an additional animator which could be attached to the camera after the base animator is. I think this would provide the best separation of code and you could put it on other nodes in your game as well if you want.
Boogle: yes. from CSceneNodeAnimatorFlyCircle I derived CSceneNodeAnimatorFlyEllipse. I was thinking about having a short but wide ellipse behind the player character, along which the camera moves very slowly.
I was also thinking of having the camera accelerate to follow the player, instead of just statically following him/her.
I would also want to detect collisions so the camera doesn't wander off into a wall or something :-X
I was also thinking of having the camera accelerate to follow the player, instead of just statically following him/her.
I would also want to detect collisions so the camera doesn't wander off into a wall or something :-X
Cool
The SWG camera (the one currently available) handles collision detection just by putting a collisionAnimator on it (as I do in my example code). Feel free to add the acceleration stuff if you want to the current camera if you need that. I'm going to leave my version as is because I wanted that camera to be more of a 'viewpoint camera' then an action camera. The TR cam will be more of an action camera.
The SWG camera (the one currently available) handles collision detection just by putting a collisionAnimator on it (as I do in my example code). Feel free to add the acceleration stuff if you want to the current camera if you need that. I'm going to leave my version as is because I wanted that camera to be more of a 'viewpoint camera' then an action camera. The TR cam will be more of an action camera.
waitasec...
set the camera to be the parent of the player? interesting, but i dunno if it would move right.....
i set the player to have no parent, and the camera up to be the child of the player...
i set the player to have no parent, and the camera up to be the child of the player...
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
okay, i think i am going crazy - i have been using Boogles character objects without a problem in my main loop - i just moved the code into a separate Player object, put in the two include files (camera and player), moved over all the calls correctly (double checked) - it compiles fine but the linker chokes on the two classes - it says
pingirr error LNK2001: unresolved external symbol "class CSceneNodeAnimator3PPlayer * playerAnim" (?playerAnim@@3PAVCSceneNodeAnimator3PPlayer@@A)
and the same for the camera class - the obj files for CSceneNodeAnimator3PPlayer - same as before
why in the WORLD would it not find the classes at link time now?
i am stumped, i have tried every variation i can think of
here is my code from the method that sets up the camera, etc inside my player object - the two .h files are included above this at the top of the file:
pingirr error LNK2001: unresolved external symbol "class CSceneNodeAnimator3PPlayer * playerAnim" (?playerAnim@@3PAVCSceneNodeAnimator3PPlayer@@A)
and the same for the camera class - the obj files for CSceneNodeAnimator3PPlayer - same as before
why in the WORLD would it not find the classes at link time now?
i am stumped, i have tried every variation i can think of
here is my code from the method that sets up the camera, etc inside my player object - the two .h files are included above this at the top of the file:
Code: Select all
CSceneNodeAnimator3PCamera *camAnim;
player->setVisible(true);
player->setPosition(x,y,z);
irr::scene::ICameraSceneNode* camera = smgr->addCameraSceneNode();
camera->setPosition(irr::core::vector3df(300,300,700));
// Create triangle selector for world (copied from collision example)
irr::scene::IMetaTriangleSelector * worldselector = smgr->createMetaTriangleSelector();
for( MapList::iterator it = spotMap.begin(); it != spotMap.end(); ++it )
{
Block* b = it->second;
irr::scene::ITriangleSelector* s = smgr->createTriangleSelectorFromBoundingBox(b->node);
b->node->setTriangleSelector(s);
worldselector->addTriangleSelector(s);
s->drop();
}
// Create the camera animator
camAnim = new CSceneNodeAnimator3PCamera(smgr,device->getCursorControl(),player->node,50,180,10,irr::core::vector3df(0,20,0));
camera->addAnimator(camAnim);
camAnim->drop();
// Add collision response to camera (second, because order is important!)
irr::scene::ISceneNodeAnimator *cameraCollision = smgr->createCollisionResponseAnimator(
worldselector,camera,irr::core::vector3df(3,5,3),
irr::core::vector3df(0,0,0), 0.0f,
irr::core::vector3df(0,5,0));
camera->addAnimator(cameraCollision);
cameraCollision->drop();
// Create the player animator
irr::scene::ISceneNodeAnimator* playerAnim = new CSceneNodeAnimator3PPlayer(smgr,camera,camAnim);
player->node->addAnimator(playerAnim);
playerAnim->drop();
// Add collision response to player (copied from collision example)
irr::core::vector3df playerDimensions = player->mesh->getBoundingBox().MaxEdge - player->mesh->getBoundingBox().MinEdge;
irr::scene::ISceneNodeAnimator *playerCollision = smgr->createCollisionResponseAnimator(worldselector,player->node,playerDimensions/2.0f);
player->node->addAnimator(playerCollision);
playerCollision->drop();
i found the problem in my code - it has to do with namespaces - i have ping as a namespace - when i had the 3PPlayer and 3PCamera in my main cpp file there was no namespace clash - but when i moved it into a class that used the ping namespace the linker could not find the class definition - so the answer for me was to wrap the camera and player 3P files in my namespace - then when they compile they match the rest of my code