FPS camera help

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
sugarhigh
Posts: 14
Joined: Sat May 28, 2005 4:11 am

FPS camera help

Post by sugarhigh »

I have seen the wiki tutorial on custom mouse and keyboard input involving this but I don't really understand that code. And before I get flames, yes I can program I just don't understand THAT code. I have also searched but no posts really involve this...

Anyway, onto my problem. I am making a game involving a first person shooter-esque camera (i.e. camera rotates with mouse) And getting the camera to rotate with the mouse is what I can't get to work. I can make the camera and everything I just cant figure out how to get the mouse input to rotate the camera with. Any help is appreciated.

Oh, and I don't want it to be like the code on the wiki where you hold down the right mouse button, I would like it to just rotate with the mouse without pressing a button. Again thanks.
ab illo cui multum datur multum requiritur
X_for_Extra
Posts: 69
Joined: Mon May 23, 2005 4:42 pm

Post by X_for_Extra »

If you are talking about the one I put up there, try replacing this:

Code: Select all

          
 //Mouse
           if(mouseRight && (mouseDX + mouseDY != 0)){
               globalRotate(camMain, vector3df(-(mouseDY*0.1f), -(mouseDX*0.1f), 0.0f));                            
               mouseDX = 0;
               mouseDY = 0;
               camMain->setTarget(camChild->getAbsolutePosition());
           }
with this:

Code: Select all

           //Mouse
           if(mouseDX + mouseDY != 0){
               globalRotate(camMain, vector3df(mouseDY*0.1f, mouseDX*0.1f, 0.0f));                            
               mouseDX = 0;
               mouseDY = 0;
               camMain->setTarget(camChild->getAbsolutePosition());
           }
Should put something witty here I suppose.
sugarhigh
Posts: 14
Joined: Sat May 28, 2005 4:11 am

Post by sugarhigh »

Yes that solved my problem, but I just found my own solution. What was wrong was I was using the "MyEventReceiver" code included in the Movement tuorial which was messing with the FPScamera in irrlicht so it works now. Mod please lock/delete this topic as it is redundant. But you may want to put that on the wiki X_for_extra, as a footnote or something.
ab illo cui multum datur multum requiritur
Post Reply