Page 1 of 2

How to disengage FPS cam to use mouse on gui?

Posted: Fri Aug 19, 2005 4:22 pm
by Athos
Currently using irrlicht engine for a small yet to be announced project.


Its in fps mode but i need and have use to use the gui with mouse too. So i wonder how to keep the current camera but disengage the mouse from the fps to use it normally klicking gui?

Greetings Athos

Posted: Fri Aug 19, 2005 7:59 pm
by WToma
(If someone read the previous, unedited version: forget it! :D)
Use setInputReceiverEnabled method of ICameraSceneNode. example:

Code: Select all

cam=scene::ICameraSceneNode* cam=smgr->addCameraSceneNodeFPS();
cam->setInputReceiverEnabled(false);
Toma

Posted: Fri Aug 19, 2005 8:06 pm
by luckymutt
I haven't tried this, but maybe he could use the

Code: Select all

 addCameraSceneNodeMaya()
where he controls the camera with the left mouse button held down, and then have a separte event for click and release on his gui buttons?
I don't see why it wouldn't work.

Posted: Fri Aug 19, 2005 11:12 pm
by Midnight
luckymutt wrote:I haven't tried this, but maybe he could use the

Code: Select all

 addCameraSceneNodeMaya()
where he controls the camera with the left mouse button held down, and then have a separte event for click and release on his gui buttons?
I don't see why it wouldn't work.
because the maya camera blows ass... it's horrible even for maya.

Posted: Sat Aug 20, 2005 1:59 am
by luckymutt
duly noted

Posted: Sat Aug 20, 2005 12:07 pm
by Athos
How do i make the switch then. Becouse i need/want to switch on the fly. But it seems i have to rewrite irrlicht engine fps camera event revicer kode in that case? or?

Becouse our eventrevicer dosnt get any messages while the fps camera is engaged. So someone i have to add a keypress event on the fps camera event revicer so it sets eventrevicer = false;

any idea how?

Best regards athos

Posted: Sat Aug 20, 2005 12:57 pm
by luckymutt
Maybe try some thing like:

Code: Select all

if (event.EventType == irr::EET_KEY_INPUT_EVENT&&
			!event.KeyInput.PressedDown)
{
		switch(event.KeyInput.Key)
		{
		case KEY_KEY_X:
if (camonoff==2) 
{ 
    camonoff=0;//to loop
}        
               camonoff = camonoff + 1;
                
               if (camonoff==1)
               { 
              cam->setInputReceiverEnabled(false);
              device->getCursorControl()->setVisible(true);
               }  
               if (camonoff==2)
               { 
              cam->setInputReceiverEnabled(true);
              device->getCursorControl()->setVisible(false);
               }  
         }
return true;
     }
  }
return false; }

};
That ought to implement releasing the camera on the first key press, so you can then carry on with your mouse click events, then return to the camera on a second key press.

I have used this to make scene nodes switch, but have never tried it with camera and mouse visiblity.

Posted: Mon Aug 22, 2005 9:36 am
by Evoker
ok that dosnt work since the irrlicht builtinf camerafps has its own event revicer so my eventrevicer wont get messages at all.

Somehow i need to access the irrlicht fps camera event revicer. becouse its that one who revices the key presses too. and have that one self turn it off some how.

Greetings Athos

Posted: Mon Aug 22, 2005 11:39 am
by Fred
Add functions to disable/enable the FPS camera to the source and recompile the Irrlicht library. If all is well, submit as a patch. I agree this is a useful feature to have, provided it's implemented properly.

Posted: Mon Aug 22, 2005 12:56 pm
by TheRLG
nah no need to edit the source or anything. disabling the camera's event receiver should work just fine, i think this is how i went about it. so when u have to bring up the gui, disable the event receiver, and when ur done with that, enable it again. easy as that.

Posted: Mon Aug 22, 2005 1:06 pm
by Athos
RabidLockerGnome wrote:nah no need to edit the source or anything. disabling the camera's event receiver should work just fine, i think this is how i went about it. so when u have to bring up the gui, disable the event receiver, and when ur done with that, enable it again. easy as that.
I think you are wrong there. Becouse how to disable it if i cant catch the events my self? If you know how to disable it. Please tell me maby show some code i would appriciate it very much.
And even if i did disable it and used my normal event revicer i couldnt enable it again and i donno why.

-Athos

Posted: Mon Aug 22, 2005 1:18 pm
by TheRLG
I'm not sure I'm understanding what you're trying to do here. If you don't want the camera to react to mouse and key events, use the setInputReceiverEnabled() function. this might not be exactly what we're looking for, but i cant exactly remember what i myself used to accomplish this. when i get home from uni, i'll have to run a few things to see what'll make this work. so what exactly are u using this for? bringing up an in-game gui or something?

Posted: Mon Aug 22, 2005 1:46 pm
by WToma
setInputReceiverEnabled() works fine, but how do you know when you have to call it? You cannot bind it to mouse or keyboard because events are captured by the event receiver of the camera.
Toma

Posted: Mon Aug 22, 2005 1:47 pm
by Athos
exactly working combat thrue fps mode while using mouse to klick menus drop and drag items and so on.

If i could get it to work.

-Athos

Posted: Mon Aug 22, 2005 8:42 pm
by TheRLG
http://jaguar.aug.edu/mricha11/RLG_Test.cpp

try that out ;-)

just hacked up source from the tutorials. but u get the point.