Qt5 FPS camera mouse movement

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
dganster
Posts: 1
Joined: Mon Apr 04, 2016 9:43 am

Qt5 FPS camera mouse movement

Post by dganster »

Hi everybody,

I have already successfully integrated Irrlicht into Qt5, and added an FPS camera to my scene (with the sceneManager->addCameraSceneNodeFPS() method).
I can also move the camera using the arrow keys, but I simply cannot get mouse movement to work.

I followed the steps here:
http://irrlicht.sourceforge.net/forum/v ... 6&p=271024

which contains this code snipped:

Code: Select all

 
void QIrrlichtWidget::mouseMoveEvent(  QMouseEvent* event )
{
    irr::SEvent irrEvent;
    
    irrEvent.EventType = irr::EET_MOUSE_INPUT_EVENT;
    
    if ( device != 0 )
    {
        irrEvent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
        
        irrEvent.MouseInput.X = event->x();
        irrEvent.MouseInput.Y = event->y();
        irrEvent.MouseInput.Wheel = 0.0f; // Zero is better than undefined
        
        qDebug() << "Mouse event: " << event->x() << "/" << event->y() << endl;
        
        device->postEventFromUser( irrEvent );
    }
    
    event->ignore();
}
 
I can confirm that the method is being called anytime I move the mouse by looking at the debug output.
However, the mouse is not captured by the window, and does not stay centered like it does in the Movement irrlicht sample.

Is there any reason why the fps camera would ignore mouse inputs?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Qt5 FPS camera mouse movement

Post by CuteAlien »

No obvious reason. The code looks pretty similar to what we use for WTL (another gui lib).

On mobile platforms (Android, iphone) CursorControl might not exist, but I guess you are not on one of those.
Easiest solution is probably compiling Irrlicht in debug and setting a breakpoint in CSceneNodeAnimatorCameraFPS.cpp in ::OnEvent and in ::animateNode. If you are working with VisualStudio that's easy to do (compile project files and then just add that project to your solution for debugging).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply