How to disengage FPS cam to use mouse on gui?

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.
Athos
Posts: 7
Joined: Fri Aug 19, 2005 4:20 pm

How to disengage FPS cam to use mouse on gui?

Post 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
WToma
Posts: 70
Joined: Tue Aug 09, 2005 8:38 am
Location: Szeged, Hungary

Post 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
"This is not a bug, this is a feature!"
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post 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.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post 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.
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post by luckymutt »

duly noted
Athos
Posts: 7
Joined: Fri Aug 19, 2005 4:20 pm

Post 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
luckymutt
Posts: 453
Joined: Sun Mar 06, 2005 11:56 pm
Location: C-Ville

Post 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.
Evoker

Post 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
Fred

Post 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.
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post 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.
Athos
Posts: 7
Joined: Fri Aug 19, 2005 4:20 pm

Post 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
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post 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?
WToma
Posts: 70
Joined: Tue Aug 09, 2005 8:38 am
Location: Szeged, Hungary

Post 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
"This is not a bug, this is a feature!"
Athos
Posts: 7
Joined: Fri Aug 19, 2005 4:20 pm

Post 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
TheRLG
Posts: 372
Joined: Thu Oct 07, 2004 11:20 pm

Post 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.
Post Reply