3rd Person Camera

A forum to store posts deemed exceptionally wise and useful

What do you think of the camera?

Great!!
33
46%
Good
25
35%
Bad
7
10%
Terrible
7
10%
 
Total votes : 72

Postby powerpop » Mon Jan 12, 2004 11:33 pm

boogle - when you get the TR style camera working let me know - that is the style i would like to have in my app! - i hope to release a raindrop animator soon - i love opensource, its so much more fun than everything only happening inside the walls of a corporation!!
powerpop
 
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

i did this sorta, but mine isn't the best way i'm sure...

Postby buhatkj » Tue Jan 13, 2004 6:22 pm

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
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
User avatar
buhatkj
 
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am

Postby qwe » Tue Jan 13, 2004 8:00 pm

or what if the camera's parent wasn't the player, but it would respond when the character moves and it wouldn't be as stiff and unyielding... I'm thinking of doing an animator with smooth acceleration. And also having the camera "breathe"(move slightly) even when the character isn't moving. :?
qwe
 
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Postby keless » Tue Jan 13, 2004 8:27 pm

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. :lol:
a screen cap is worth 0x100000 DWORDS
keless
 
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

not wierd, imaginative

Postby buhatkj » Tue Jan 13, 2004 8:51 pm

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
User avatar
buhatkj
 
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am

Postby Boogle » Wed Jan 14, 2004 2:55 am

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.
Boogle
 
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Postby qwe » Wed Jan 14, 2004 3:11 am

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
qwe
 
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Postby Boogle » Wed Jan 14, 2004 3:36 am

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.
Boogle
 
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

waitasec...

Postby buhatkj » Wed Jan 14, 2004 3:35 pm

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...
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
User avatar
buhatkj
 
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am

Postby Boogle » Wed Jan 14, 2004 5:25 pm

No parenting!

Don't set the camera as child or parent of anything. If you set the player as child of something, you'll likely have to update the camera code to use getAbsolutePosition() rather than getPosition() when determining the position of the player.
Boogle
 
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Postby powerpop » Wed Jan 21, 2004 3:13 am

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:

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();
powerpop
 
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Postby keless » Wed Jan 21, 2004 3:31 am

did you do a make clean first?
a screen cap is worth 0x100000 DWORDS
keless
 
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Postby powerpop » Wed Jan 21, 2004 8:04 am

completely clean - this is really wierd - i have gone through line by line - i just cant figure out why the compiler would not complain and then the linker would when the obj files are right there as they always were

grrrrr
powerpop
 
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Postby Homer » Wed Jan 21, 2004 10:39 am

i have exactly the same problem. would be nice if someone could find a reason for this because i'm no c++ pro.

thx in advance
Homer
 
Posts: 58
Joined: Tue Nov 18, 2003 7:11 pm
Location: Germany

Postby powerpop » Wed Jan 21, 2004 10:52 am

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
powerpop
 
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

PreviousNext

Return to FAQs, Tutorials, Howtos, and external tool lists

Who is online

Users browsing this forum: No registered users and 1 guest