How to rotate FPS with keys?

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
pverlaine999
Posts: 16
Joined: Wed May 04, 2011 12:30 pm

How to rotate FPS with keys?

Post by pverlaine999 »

Sorry if this sounds like a stupid question.

When I have a FPS camera, I can use the mouse to rotate the camera and look at my target. It feels very smooth. But on a system that has no mouse, I'd like to handle camera rotation with keys.

I got a few questions here:

1) I can catch my key event, and try to compute the rotation. Ok, my math is a bit rusty now, but it does not feel as smooth as the built-in mouse-based rotation. Is there any simple code snippet I can learn from? I remember to see a FPS rotation code snippet posted by someone here, but when I want to look it up now, I just couldn't find it.

2) In order to learn from the engine, I look into this method:

Code: Select all

void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
This seems quite complicated, but I'd like to confirm if this is the right place to look into. I remember that the code example posted by someone on this forum was quite simple.

3) Let's say I got key-based rotation as smooth as I want now, but everything seems to be mouse-based in Irrlicht. But on Android, there's no mouse. Is there an easy way to replace mouse movement with key presses? Or, do I have to re-do event handling in every class to replace mouse movement?

Thanks for any hint.

Paul
[/code]
Post Reply