questions about the 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
Janx
Posts: 4
Joined: Tue Jan 23, 2007 6:09 am

questions about the camera

Post by Janx »

Hey all! :)

I found out about Irrlicht a few days ago and I really love it
so far, however being a beginner in C++, game programming,
and 3D programming as well (and trying to learn all three things
at the same time), I have some problems (btw:
the nice structure of Irrlicht makes it awesome for learning about OOP).

The most important one at the moment is the normal camera.
The FPS camera works of course, but I want to build a 3rd person
camera that flies behind my player model.

I know there are a few threads where people posted solutions, but
to be honest I want to try it alone and just need some basic
information.

What is the normal camera actually doing?
When I used the same code that I had used for movement with the
FPS camera, the normal camera moved very different, and not at all
the way I would have expected.

Basically I just changed the x, y, z coordinates of the camera
when the w a s d keys where pressed, which like I said worked
for the FPS camera.

After putting all coordinates on the screen (camera position,
player position) I was hoping to find out why the camera behaved
the way it did.
By chance I saw the .setTarget function of the normal camera and
figuered maybe the problem is that the camera always points at
a target, which would explain the weird movement of the camera
when I just changed it's coords.

So I put the playernode as the cameras target, and changed the
position of the playernode and camera simultaniously when
a w s d keys are pressed (both every time a key is pressed).

The camera now behaves the way a normal 3rd person cam does,
however there is huge lag/graphic artifacts (whatever it is called)
when I move to the side.

Would be great if anyone could clarify for me how the camera
actually works, thanks alot :)
xtheagonyscenex
Posts: 131
Joined: Fri Jun 03, 2005 7:26 pm

Post by xtheagonyscenex »

i dont understand what your asking? :?: :oops:
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
Janx
Posts: 4
Joined: Tue Jan 23, 2007 6:09 am

Post by Janx »

I was asking why, when I change the coordinates of the normal camera, it does strange things like fly in a half circle and stuff instead of just going to the new coordinates.

But it's not so important anymore :P
xtheagonyscenex
Posts: 131
Joined: Fri Jun 03, 2005 7:26 pm

Post by xtheagonyscenex »

maybe you have coordinate mixed the x,y,z and what camera you using you can the FPS cam and if you dont want to use the mouse just turn it off
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
Janx
Posts: 4
Joined: Tue Jan 23, 2007 6:09 am

Post by Janx »

The thing is I want the player to be able to switch between a FPS kind of camera, and a free camera where he can use the mouse freely.

About mixing up the coordinates: if I press the 'a' key for example, the X coord gets reduced. But in the game, the camera flies in a kind of half circle instead of moving along one axis, and I dont really understand why/how that happens.

But I'm suspecting it to have something to do with the target of the camera...
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

No, the camera is not flying in a courve...
But it still looks at a specific point (lookat / target) !!!
If you move to the left the camera looks to the right to it's target...
So you also have to change the target (look at) of the camera...

Also use cam->updateAbsolutePosition() after changing the position of the camera !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Janx
Posts: 4
Joined: Tue Jan 23, 2007 6:09 am

Post by Janx »

updateAbsolutePosition() helped, thanks alot :)
Post Reply