I'm needing to have the camera of the scene respond only when the middle mouse button is clicked. I've tried a couple of methods, but none seem to work.
This is the code I'm using in the event handler:
case EMIE_MOUSE_MOVED:
if (held) {
double difx = oldx - event.MouseInput.X,dify = oldy - event.MouseInput.Y;
oldx = event.MouseInput.X;
oldy = event.MouseInput.Y;
camera = smgr->getActiveCamera();
vector3df rot = camera->getRotation();
double adjust = asin(difx/MOUSE_MOVE);
rot.rotateXZBy(adjust,camera->getPosition());
adjust = asin(dify/MOUSE_MOVE);
rot.rotateXYBy(adjust,camera->getPosition());
camera->setRotation(rot);
return true;
}
break;
anyone have any idea as to what is wrong with the code? or if someone already has something like this, and is willing to share, I'm fine with that.
Camera moving
-
thesmileman
- Posts: 360
- Joined: Tue Feb 10, 2004 2:20 am
- Location: Lubbock, TX
If you use an arrary to handle input like described by keyless in the forum(A very good way to do it I might add) you can do something like this:
search the fourm to find the input method by Keyless it really is very good.
Code: Select all
if(EMIE_MOUSE_MOVED && !keys[LEFT_MOUSE] && !keys[RIGHT_MOUSE] && keys[MIDDLE_MOUSE])
{
//do something
}No, I believe I have confused you. I can't get the camera to work right, and I have a feeling it's something to do with how I'm doing things mathmatically, or something. I can understand what you mean, with the method you describe, that would remove some unnessisary variables, and I may use that for the main system, however that isn't the problem.
Basically, it's the Maya cammera, just with middle button activates it's moving around instead of the left button.
Basically, it's the Maya cammera, just with middle button activates it's moving around instead of the left button.
Think it was Keless 
And here's the link because the search engine of this forum is kinda horrible
http://irrlicht.sourceforge.net/phpBB2/ ... light=keys
And here's the link because the search engine of this forum is kinda horrible
http://irrlicht.sourceforge.net/phpBB2/ ... light=keys