Changing controls for FPS Camera?
-
- Posts: 13
- Joined: Thu Mar 27, 2008 2:59 am
Changing controls for FPS Camera?
I'm looking at the parameters for the addCameraSceneNodeFPS function and theres two dealing with the key map or something along those lines. Can I use that parameter to change what controls the camera? I'd rather be using WASD rather than the arrows.
I use this:
Code: Select all
SKeyMap keyMap[4];
keyMap[0].Action=EKA_MOVE_FORWARD; keyMap[0].KeyCode=KEY_KEY_W;
keyMap[1].Action=EKA_MOVE_BACKWARD; keyMap[1].KeyCode=KEY_KEY_S;
keyMap[2].Action=EKA_STRAFE_LEFT; keyMap[2].KeyCode=KEY_KEY_A;
keyMap[3].Action=EKA_STRAFE_RIGHT; keyMap[3].KeyCode=KEY_KEY_D;
scene::ICameraSceneNode* camera=smgr->addCameraSceneNodeFPS(0,100,500,-1,keyMap,4,false,0);
-
- Posts: 31
- Joined: Thu Jun 07, 2007 6:23 pm
- Location: New York
- Contact:
On a similar note, I'm looking in the documentation but I can't seem to find a way to dynamically change the keyboard mapping for a FPS camera. Do I really have to recreate the camera to change the mapping?
Thanks
Thanks
Computer scientist by day...
http://www.mrjoelkemp.com
http://www.mrjoelkemp.com
According to the docs, the camera uses a pointer to the keymap, so in theory you could just alter the keymap, ie call:
somewhere after the camera is made. I have not, however, tested this, so it might not work. If it doesn't, I suspect the only way would be to make your own FPS camera from scratch.
EDIT: I just tested it and it appears that it doesn't work, so I guess it cannot be done the way I said. Sorry.
Code: Select all
keyMap[0].KeyCode=KEY_KEY_J;
EDIT: I just tested it and it appears that it doesn't work, so I guess it cannot be done the way I said. Sorry.
Not currently possible, however, if you're using SVN trunk the FPS camera is just a normal camera with a special animator.
You can get access to this animator by calling cam->getAnimators() and casting the one with getType() == ESNAT_CAMERA_FPS to an ISceneNodeAnimatorCameraFPS. You can then set the keys, move speed etc through the animator's interface.
If you're not using SVN then I guess you'll have to wait for Irrlicht 1.5
You can get access to this animator by calling cam->getAnimators() and casting the one with getType() == ESNAT_CAMERA_FPS to an ISceneNodeAnimatorCameraFPS. You can then set the keys, move speed etc through the animator's interface.
If you're not using SVN then I guess you'll have to wait for Irrlicht 1.5
-
- Posts: 31
- Joined: Thu Jun 07, 2007 6:23 pm
- Location: New York
- Contact:
Thanks guys.
@Ion
That's a solution that came to my mind after further analyzing the documentation. Thanks for testing it though.
@bitplane
I'm not currently accessing the Irrlicht SVN, but thanks for the information. The quick fixes that I know of will suffice for now.
Looking forward to 1.5!!
Thanks again.
@Ion
That's a solution that came to my mind after further analyzing the documentation. Thanks for testing it though.
@bitplane
I'm not currently accessing the Irrlicht SVN, but thanks for the information. The quick fixes that I know of will suffice for now.
Looking forward to 1.5!!
Thanks again.
Computer scientist by day...
http://www.mrjoelkemp.com
http://www.mrjoelkemp.com