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

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

Post by powerpop »

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

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

Post by buhatkj »

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

Post by qwe »

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. :?
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

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

not wierd, imaginative

Post by buhatkj »

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

Post by Boogle »

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

Post by qwe »

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

Post by Boogle »

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

waitasec...

Post by buhatkj »

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

Post by Boogle »

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

Post by powerpop »

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();
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

did you do a make clean first?
a screen cap is worth 0x100000 DWORDS
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Post by powerpop »

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
Homer
Posts: 58
Joined: Tue Nov 18, 2003 7:11 pm
Location: Germany

Post by Homer »

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

Post by powerpop »

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
Post Reply