Thursday, 5 February 2009

Qt and First Person Shooter Controls

I've been looking for a way to implement first person shooter controls in Polyworld so that I can move around the world to check that things are okay.

Unfortunately, Polyworld was built on top of Qt which allows me to get the cursor position but not whether the cursor is moving and in which direction.

For example, if Polyworld is window mode, when the mouse goes out of the window, Qt cannot track whether the mouse is still moving.

If Polyworld is in full screen mode, when the mouse reaches a screen edge, Qt cannot track whether the mouse is still moving.

It is strange because I can get the cursor position from a mouse press event. This means that if I want to be able to move the camera the way I want, I need to be pressing a mouse button at the same time.

So what I've done is implement first person shooter controls with the keyboard, WASD for movement, ARROW keys for orientation and PAGE UP DOWN keys for elevation.

Qt 4.3.2

No comments:

Post a Comment