Page 1 of 1

[SOLVED]Help 3rd person camera

Posted: Wed Oct 28, 2009 8:35 am
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

Re: Help 3rd person camera

Posted: Wed Oct 28, 2009 8:39 am
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

Posted: Wed Oct 28, 2009 12:28 pm
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.

Posted: Thu Oct 29, 2009 4:03 pm
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

Posted: Fri Oct 30, 2009 6:45 am
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.

Posted: Fri Oct 30, 2009 11:30 am
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.