How to move an orthogonal 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
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

How to move an orthogonal camera?

Post by Krampe »

Hi @ll,

i created a scene with an orthogonal camera (thanks to saigumi), everything worked fine. Now i want to move that camera using the keyboard, but my app is crashing right from the start (illegal page).

When i use a normal camera node, everything is allright; my movement code is straight out of tutorial 4. When changing back to orthogonal projection, im getting this crash again.

Perhaps someone can help me? Thx :)
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Ah... yeah.

First, you can't use any of the Extra cameras that Niko has. These are set up for non-ortho movement.

I haven't figured out the intricacies of the camera movement yet after playing with it for 2 weeks. So, I did some codepath chopping and instead of moving the camera, I found it 1000 times easier to move the world and leave the camera projection matrix alone.
Crud, how do I do this again?
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

First, you can't use any of the Extra cameras that Niko has. These are set up for non-ortho movement.
Im using an ICameraSceneNode (app crashes at start):

Code: Select all

irr::scene::ICameraSceneNode* camera = smgr->addCameraSceneNode(0,irr::core::vector3df(-10.0f, 10.0f, -15.0f),irr::core::vector3df(0,0,0));
irr::core::matrix4 MyMatrix;
MyMatrix.buildProjectionMatrixOrthoLH(200.0f,200.0f,200.0f,-200.0f);
camera->setProjectionMatrix(MyMatrix); 

Its running fine if i
a) dont use the movement code from tutorial 4 or
b) replace the above code with just a simpe camera node:

Code: Select all

camera = smgr->addCameraSceneNode();

I dont know what to do now :/
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Well, I'm not sure what you mean by movement code from Tutorial 4. The only movement I see is to move a Node that has the block attached, the camera still uses smgr->addCameraSceneNodeFPS(0, 100.0f, 100.0f);

As far as why, it's crashing... that's unexpected. When trying to use the FPSCamera everything just looks funky after moving or rotating the camera. (Like I said in the howto, rotating the camera gives surpring effects)

The only thing I can think of is that your ortho matrix looks huge. Try a smaller set first to see if it crashes.
Crud, how do I do this again?
Krampe
Posts: 48
Joined: Tue Oct 14, 2003 8:37 pm

Post by Krampe »

I used the node-movement from tutorial 4 and applied it to my ICameraSceneNode. I didnt use the fps or maya camera. When using normal projection, the camera works fine and moves as it should.

I tried it for fun with the FPS camera, and it worked without errors or funky looks o.O No problems there for me (just moving).

I tried to change the values as you suggested, the app started without errors (happened before, it seems to be random?!), but when i pressed the W button to move the camera up, it crashed again... there the app is crashing every time... if not at startup....

:shock:
Post Reply