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.
FPS camera help
FPS camera help
ab illo cui multum datur multum requiritur
-
- Posts: 69
- Joined: Mon May 23, 2005 4:42 pm
If you are talking about the one I put up there, try replacing this:
with 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());
}
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.
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