About 3rd-person cameras

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
Astaelan

About 3rd-person cameras

Post by Astaelan »

Hello, to start off I'd like to say I am fairly new to the 3D programming world, I've spent some time reading up on OpenGL, tried to understand some of the stuff, and then came across the Irrlicht engine.
What I have been trying to accomplish, appears to be possible with Irrlicht. I want to set up a camera, that can rotate (orbit?) around a point (not it's own center, but rather the target of it's view), as well as zoom in and out, and finally tilt the view as well. The effect of which, is to produce a completely free-form (but limited) camera view around the character in a third-person perspective. The character will rotate, itself indepedantly as it moves, while the camera can be moved around (by keyboard) to get different angles.
I have not yet worked with Irrlicht, I have only looked over the API and have a few ideas, but I would like to get some feedback on how someone experienced with Irrlicht would handle the actual transformation of the camera's position in each of the 3 cases. As I said, I do not have a lot of experience with 3D programming, but I have strong C/C++ skills otherwise.
I hope someone is willing to help an aspiring, and ambitious programmer learn how to use this great engine. It really seems like it will do all the work I was trying to recreate.
Hopefully it can handle the sort of camera transformations I need, thanks for the help in advance!
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

All of those camera movements is relatively simple.

For a third person perspective, you could even make the camera a child node of another node, like a player node, and it will follow them. Then you would just need to have code that moves the camera. This movement would be relative to the player node because Irrlicht handles relative transformations (movement) for you.
Crud, how do I do this again?
Guest

Post by Guest »

I would really appreciate if you could give me some example code, or point me to a resource that might help.
I don't understand matrix math yet, how it all works, but with some examples I could probably figure it out. I have figured out how to orbit on the height axis, and zoom in/out in OpenGL, but I wasn't able to figure out the scaling up and down. I thought Irrlicht might make this easier.
I understand the concept of attaching a camera node as a child to move with the character, this does the actual transformation of movement against the world. But what I don't understand, and was hoping someone might be able to help me understand, is the math/code involved in having the camera rotate around the target it's looking at (which may well be the parent node, and constant target of the camera view).
The idea is that with the 4 arrow keys, and page up/page down, the view around the character can be controlled. So far, all I have seen are FPS and third person that strictly follows, with no free-form of the perspective. I am sure it's simple, has anyone done this? It's probably a few simple translations, I just don't understand the math involved.

Hopefully someone can help.
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

It sounds like you need more help than most people feel like typing in a forum. Maybe you should check out some books or tutorials on the internet...
Guest

Post by Guest »

And yet you still haven't offered any resources. I've asked for some, and all you said is "You should go look at some" ... Thanks for nothing.
As I've said, I've looked around, I've spent a good 2 weeks just researching information on 3D programming, and trying to find a decent resource that explains some of the simpler concepts. I've spent time reading the OpenGL Red Book, but this information is all tuned for someone who's had years of experience with matrix math.
Irrlicht is the first step into 3D so far that has made a little sense, and I think that a Flyaround animator on the camera may provide what is needed, if it's turned on and off by keypress/depress. If this works, maybe I'll release a camera class for Irrlicht, since it seems to be a common question with no code examples.

I think that saigumi was trying to explain what I've realized, that the flyaround animator will transform relative to it's parent, which can be the player model.

By the way, off topic from cameras, but has there been any break-throughs with terrain mapping? I would like to use a raw heightmap most likely, I've seen a lot about this topic, not sure what the best base code to start working with.
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Resources with good tutorials on basic 3D concepts:
http://www.flipcode.com
http://www.gamedev.net

3rd Person camera posting from a while ago with source- http://irrlicht.sourceforge.net/phpBB2/ ... son+camera

You don't need the matrix math with Irrlicht as it handles that for you.

http://irrlicht.sourceforge.net/docu/cl ... eNode.html

getTarget will point at any location when you give it a vector3df of (x,y,z).
Since the ICameraSceneNode is derrived from ISceneNode, you can use setPosition(x,y,z) to place the camera. Once again, no matrix math or handmade transformations required.

For more detailed camera work, you have setFOV (field of view), setAspectRatio, setNearPlane, setFarPlane, and so on.

SceneNodes aren't discussed in any DirectX or OpenGL book because they themselves aren't a graphic just a point in space that would hold the mesh being used. It's easier to grasp the concepts of sceneNodes by running through and experimenting with Niko's set of tutorials, not just reading through them.

http://irrlicht.sourceforge.net/phpBB2/ ... son+camera

http://irrlicht.sourceforge.net/tutorials.html

As far as terrain, there is KnightofFlight's Quadtree one and Gorgon Zola's which was more robust. Both used heightmaps but neither are fully fleshed out yet with code like anti-popping and such. Though Niko is planning on rolling out a terrain scene node in the 0.50 version.

We beat the Terrain horse to death quite a while ago, but somewhere in there was a link to a easilly read and good book on learning how to implement your own terrain, "Focus on 3D Terrain Programming" from Premier Press.
Crud, how do I do this again?
Guest

Post by Guest »

Thanks Saigumi. I think I had already managed to find most of the places you pointed out, and looked it over already.
However, I am now trying my own implementation with Irrlicht, and have a new question still regarding camera's.
The way I've decided to implement camera movement, is by using createFlyCircleAnimator, creating it when the key is held down and removing it when the key is released. For the most part, it seems to work. However, I ran into the problem that each time the animator is recreated, it repositions at the start of the sequence, instead of staying where it left off. So what I am wondering now, and have not found in the API, is whether there is a way you can simply "stop" the animator, without removing it. Simply halt the animator at it's current point, and let it resume at a later point. If so, I could create the animator once right away, and enable it while the key is held down.
Can anyone verify a way to stop and start a flycircle animator without resetting it, I don't see anything in the animator or scene node for it.
hearsedriver
Posts: 81
Joined: Fri Aug 22, 2003 12:06 pm
Location: Germany
Contact:

Post by hearsedriver »

I'd suggest to simply add and remove the animator from the scenenode when needed. To avoid destruction of the animator, simply "grab" it from your main code (I guess I won't need to explain the principle of reference counting to someone with "strong C/C++ skills" ;)

Cheers.
matthias gall, lead programmer at sechsta sinn - email matthias@sechsta-sinn.de
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Anonymous wrote:And yet you still haven't offered any resources. I've asked for some, and all you said is "You should go look at some" ... Thanks for nothing.
Jesus dude, chill out I'm not your mother. You do know how to research stuff on the internet, right? I'll tell you the same thing I told Krampe: If you do not understand what is going on in the basic Irrlicht tutorials then you need to get a good book on C++ like the "Standard C++ Bible" by Al Stevens & Clayton Walnum. Read and practice that whole book and you will be a C++ expert. Also, a good book on game programming would help like Tricks of the Windows Game Programming Gurus by Andre LaMothe, but you should already know C++ good before starting a game programming book. Of course there are other good books and game programming tutorials on the net, just do a Google search.

So, hold my hand tight :x... use your other hand to wipe with :?... and now type in http://www.gametutorials.com :shock: there are lots of good tutorials there on basic C++ programming as well as graphics programming techniques in OpenGL and DirectX (stick with OpenGL, it's easier).
Guest

Post by Guest »

What a condescending smartypants. I'm not going to get into a flame war with you over your lack of being useful. I've already been to www.gametutorials.com and yes, it's been useful to a point, but has yet to actually explain anything I've been trying to figure out. I already know C/C++. And if I just wanted another FPS, I suppose doing what everyone else is and plopping in tutorial code with some new textures to call my own would suffice. I have a desire to learn a little more, but I can see you'd rather waste your time griping and belittling people, rather than reference a few examples. I've never found a so called "beginner development forum" so hostile.
I can't even justify anything more to say to you, it just bewilders me how ignorant you are. Don't bother trying to "help" anymore, I've decided not to use Irrlicht based on the community "support", which I thought was one of it's key points at first.

hearsedriver: Suggestions noted, I already considered this, except that the flycircle animator is time based, which means it will warp around the scene depending on when it's readded, which doesn't work quite right. The approach I was considering, was to write a similar scene animator based on a degree instead of time. I was about 90% there I think.

Best of luck Niko, your engine looks great so far, back to OpenGL for me.
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

I'll repeat... chill out. There was no hostility here until you brought it in. There are 129 users on this forum and no one is gonna help a guy making remarks like "thanks for nothing" to the people who are already trying. BTW, there's no need for cursing, we do have some younger members here.
Saalen
Posts: 51
Joined: Thu Sep 04, 2003 7:49 am
Location: Germany
Contact:

Post by Saalen »

[dx/x]=HUNT3R wrote: So, hold my hand tight :x... use your other hand to wipe with :?... and now type in http://www.gametutorials.com :shock: there are lots of good tutorials there on basic C++ programming as well as graphics programming techniques in OpenGL and DirectX (stick with OpenGL, it's easier).
I guess that was slightly to sarcastic :?:
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

Anonymous wrote:And yet you still haven't offered any resources. I've asked for some, and all you said is "You should go look at some" ... Thanks for nothing.
Yeah well this was too...
Post Reply