camera question (demo included)

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
danut007ro
Posts: 16
Joined: Thu Apr 12, 2007 2:21 pm

camera question (demo included)

Post by danut007ro »

I'm building a simple physics simulation program and I have written a custom camera based on the FPS camera included with Irrlicht...

Problem is that I'm trying to make the camera orbiting around the center and move it with the mouse. I managed to make the camera move but it looks like it is first moved and then targeting the center (you'll see what I mean). Also, camera moves ok (kind of) around Y axis, but wrong around X axis...

Source for the camera is included in the zip.

ftp://216.75.41.174/demo.zip
Press the upper button to start the simulation, and Right Click to move camera... WSAD to move, and RF to move up/down, X to reset camera position.

Thanks...
JonLT
Posts: 152
Joined: Thu Mar 15, 2007 5:47 pm
Location: Denmark

Re: camera question (demo included)

Post by JonLT »

danut007ro wrote:I'm trying to make the camera orbiting around the center
What if you move past the center? Then the camera would turn around and look back at the center, when you rotate it. I think it would be much more intuitive to have the camera rotate about the center of the view( the target).
I think the Maya camera would be more usefull to you than the FPS camera.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You might have a look at the spherical camera code that I posted here a while back.

Travis
danut007ro
Posts: 16
Joined: Thu Apr 12, 2007 2:21 pm

Post by danut007ro »

I'm trying to implement my camera, with zoom and stuff.
If I move past the center I guess I will check that. But first I need the rotation code.

Travis : how to get the angles using current camera position? I mean I should get the angles every frame, calculate new position using your code, and then update the position. Sorry about that, but I'm quite weak at 3D math.

Thanks.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

I'm now hosting the demo on my site.
danut007ro
Posts: 16
Joined: Thu Apr 12, 2007 2:21 pm

Post by danut007ro »

Midnight, if you mean object orbiting camera.rar, I already got that file, liked how it looks. But still it doesn't fits my needs. I need the camera to be FPS and also Maya-like.

So I guess I need to get those angles (Phi, Theta) every frame when I do rotation from the current camera position, calculate new position and then move it.

Maybe I'm wrong... Again, I'm not too good at 3D.
Post Reply