Camera Question

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
CmdKewin
Posts: 29
Joined: Thu Aug 17, 2006 1:49 pm

Camera Question

Post by CmdKewin »

Yes, again... I've spent the last few hours looking trough the 50 or so pages of the search result without finding any hint.

I want to implement a camera who does the following:

1. Rotates around a specified node.
2. Zooms with the mouse wheel.
3. Pans left,right,up and down when the cursor is within an user defined space.

1. I can do that with addCameraSceneNodeMaya. Works well.
2. Derived class from above.
3. I wrote that myself. Works well.

Now, I can do only one of the above at any time, i.e. I can pan up and down easily, but after I do that, the Maya camera starts behaving strangely. It doesn't move around some point in 3D space (a node, for instance), but around the mouse cursor. What i do get is a weird 2D spatial motion. As if moved the viewport around.

I understand the math behind a complex camera, in fact, i wrote such one in pure C and OPENGL, a few years back (I uploaded a quick video on youtube http://www.youtube.com/watch?v=6UzWlMsugXo just to get the idea...).

Any quick tips? Other than rewriting everything from scratch again....
Gatekeeper
Posts: 31
Joined: Fri Apr 21, 2006 12:00 am
Location: Australia

Post by Gatekeeper »

Why not just write an EventReceiver that does all of that stuff for you on a normal, standard camera?
CmdKewin
Posts: 29
Joined: Thu Aug 17, 2006 1:49 pm

Post by CmdKewin »

That's what I tought in the first place... But i seem to have problems with setTarget. As i understand it, position and target functions are always relative to the current point, not to a global position (starting from say [0,0,0], the origin).

I will give it a try another time and see how far i can get this time.
Dibalo
Posts: 30
Joined: Sat Aug 12, 2006 2:31 pm
Location: Finland
Contact:

Post by Dibalo »

I recommend that you´ll make your own camera class. Then you exactly know, what your camera will do. I have made my own camera class. It´s containing moving methods: Move(forward/backward, strafe[optional], up-down[optional]), Turn(axis[X or Y], turnvalue), Rotate(axis, angle), LookAt(target) and Position(newPos). I think it´s much easier using own class than trying to set up something with non-suited cameras.

Those are enought to me. When combining your camera class with your event receiver, you can do with your camera everything you want. An easy way to create camera, is using a direction vector (unit vector) to tell camera´s rotation and hande a movement (new pos = cur pos + direction*value). :)
Dattebayo!!
Post Reply