[SOLVED]Help 3rd person camera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Isoprog
Posts: 80
Joined: Wed Dec 10, 2008 7:53 am

[SOLVED]Help 3rd person camera

Post by Isoprog »

Hi,
Can somebody show me the code how to rotate camera around a node with mouse without clicking.
I applied movement to the nodemesh using WASD key like in tutorial "Movement". It is moving perfectly. Now want to rotate the camera. In brief i want a camera control like Prince or Persia or Max Payne.
There are many thread in irrlicht forum but non of them is like what i want.
I would be really greatfull if some one can solve my problem. Thnks for ur reply.

regards
Last edited by Isoprog on Fri Oct 30, 2009 11:39 am, edited 4 times in total.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Help 3rd person camera

Post by randomMesh »

Please read this thread. It has a nice example of a camera using spherical coordinates.

PS: Prince of persia was side view back in the days, so it doesn't help if you say you want the same camera.
Image
"Whoops..."
someguy99
Posts: 38
Joined: Sun Oct 11, 2009 11:20 am

Post by someguy99 »

Sounds just like what i wanted to do.
You said you want the camera to rotate without clicking, so i assume you tried irrlicht Maya camera. You can just take the maya camera .cpp and .h files (dont remember their names) and make your camera from that.
Probably needs to change few lines of code.
PS. Im currently having trouble with parenting Maya camera to node, so im not sure if this will work.
Isoprog
Posts: 80
Joined: Wed Dec 10, 2008 7:53 am

Post by Isoprog »

Mr RandomMesh,
thanks for reply. Well, i m talking about Prince of Persia(sands of time, two throne) PC game. They r all 3rd person 3d game.
could u kindly tell me how to rotate the camera around the hero. I m using simple camera.
Mr Someguy99,
thanks to u too. As i already said, i m using neither Maya nor FPS camera. I m using normal camera.
thanks for ur reply
Brainsaw
Posts: 1183
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

I am using a "third person camera" (more precise: a "third marble camera") im my current project "marbles2 - the Race" (see project announcements forum). I simply calculate the position of the camera before each frame is rendered and set the camera to the calculated position. You could take a look at "irrOdeMarble", the demo game included in my "IrrOde" wrapper (see signature) how I've done this.

The way I do it is the "lazy man's approach" (have coded that years ago and am too lazy to modify), but I think that it would not be a problem to put that code into a SceneNodeAnimator which would be the cleaner way to do it.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Isoprog
Posts: 80
Joined: Wed Dec 10, 2008 7:53 am

Post by Isoprog »

Thanks Bransaw,
i downloaded ur examples but i could not play the demos. it crashes. i don't know why. anyway thanks for ur advice. i suddenlly found the solution and my problem is solved.
i found a ready made source code which uses the irrlicht engine and with 3rd person camera, exactly like what i was looking for. in our language, there is a saying" Jab Allah Meherban Toh Gadah Bhi Pahelwan". that is what happend to me.
anyway thank u all guys, for ur support and kind help.
Post Reply