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
Malaidas
Posts: 16
Joined: Wed Feb 25, 2004 1:15 pm

Cameras

Post by Malaidas »

Hi all

I'm trying to create my own FPS type camera yet am having problems.

I've created a custom event handler which currently processes only mouse movements. I've worked out the change in angle correctly (in radians) and now wish to update the camera. To do this I'm getting the camera current rotation used the ISceneNode method, updating its values and then trying to pass the new information back to the camera again using the SceneNode method. However here comes the problem. When I next get its rotation its either been reset, or was never set internally because its value remains constant.

What am I doing wrong?

Cheers

Steve
Guest

Why not that??

Post by Guest »

use addCameraSceneNodeFPS()
for help, just look into irrlicht help... 8)
Malaidas
Posts: 16
Joined: Wed Feb 25, 2004 1:15 pm

Post by Malaidas »

Thanks for the advise but I'm truying to extend the FPS camera for a specific reason

The FPS Camera doesn't work quite like a real FPS camera, its more of a spectator camera.

Even with gravity etc it still attempts to move in the direction you are facing in the Y so you get a straight bouncing movement when you are looking upwards. Rather than the normal FPS style which only moves in relation to your X/Z angle or to be more precise your angle around the Y axis

The FPSCameraSceneNode is therefore great for the purposing of viewing your level, space games etc but not quite right for a proper FPS.

Steve
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

Maybe if you show some code, we can help more, for now: have you made sure that the values for position/rotation e.d. are stored outside the function that animates it, so you dont end up with losing your values when your func. goes out of scope, secondly: are the values in degrees? Its also good practice to look at the source of the FPS cam and see how niko does it, that is the way I learned to modifi my cam. But do not use the fpscam as base class, but a normal cam, because the SetTarget does not work correct in the fpscam.
Phunk
Posts: 78
Joined: Sun Dec 14, 2003 8:18 pm
Location: The Netherlands

Post by Phunk »

double post. sorry for that :oops:
Last edited by Phunk on Tue Mar 02, 2004 10:48 pm, edited 1 time in total.
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

hi Malaidas

why don't you just copy the code from nikos fps camera and add the things you need?

if you do a camera by your own you have to keep in mind that a camera node is somewhat special i.e. look at the function setTarget() and at the implicatons setting the target has in "OnPreRender()"

good luck
Gorgon
Malaidas
Posts: 16
Joined: Wed Feb 25, 2004 1:15 pm

Post by Malaidas »

HI all and thanks

I've actually been trying to copy nicos but have run into problems see my namespaces post. Further to this I found out that FPSCameraSvene node cannot be easilly subclassed as it limiots the interface to public only or something,

Currently it looks like I'm going to have to create my own versions of both CameraSceneNode and FPSCameraScene node in order to do it, but I haven't had a moment to test this yet

Thanks all for your help again

Steve
Malaidas
Posts: 16
Joined: Wed Feb 25, 2004 1:15 pm

Post by Malaidas »

Oops Missed your post phunk, yeah I've noticed problems with subclassing, I couldn't even get it to compile. I noticed that there was something wrong with setTarget when I tried to reproduce the code in non OOP format. I got it moving fine (well with a bad blur on sidestepping but barring that). Trying to put a set Target in caused it to lock eother looking up or down ??????

The setTraget seems necessary after a collision. GUess I'd better go back to my maths text book :)

Steve[/b]
Post Reply