Now, I use the .NET wrapper for irrlicht, so some of my terms or whatever might be a little off, but any help is welcome
When I make the built-in FPS camera, it is only controlled through the arrow keys. If I wanted it to be a traditional FPS-style camera, how would I go about setting it to be controlled by WASD? Would I have to check for keypresses each frame and move the camera accordingly, or is there some other built-in function to switch the controls?
Thank you! :]
WASD for FPS Camera
TheBeef wrote:Searching the BBS and the wiki (and the camera class in the API) returns nothing of relevance.MasterGod wrote:Search the freaking forum and look on the freaking docs
Thanks for the help!
Freaking API :D wrote:virtual ICameraSceneNode* irr::scene::ISceneManager::addCameraSceneNodeFPS ( ISceneNode * parent = 0,
f32 rotateSpeed = 100.0f,
f32 moveSpeed = 500.0f,
s32 id = -1,
SKeyMap * keyMapArray = 0,
s32 keyMapSize = 0,
bool noVerticalMovement = false,
f32 jumpSpeed = 0.f
) [pure virtual]
Adds a camera scene node which is able to be controlled with the mouse and keys like in most first person shooters (FPS).
Look with the mouse, move with cursor keys. If you do not like the default key layout, you may want to specify your own. For example to make the camera be controlled by the cursor keys AND the keys W,A,S, and D, do something like this:
SKeyMap keyMap[8];
keyMap[0].Action = EKA_MOVE_FORWARD;
keyMap[0].KeyCode = KEY_UP;
keyMap[1].Action = EKA_MOVE_FORWARD;
keyMap[1].KeyCode = KEY_KEY_W;
keyMap[2].Action = EKA_MOVE_BACKWARD;
keyMap[2].KeyCode = KEY_DOWN;
keyMap[3].Action = EKA_MOVE_BACKWARD;
keyMap[3].KeyCode = KEY_KEY_S;
keyMap[4].Action = EKA_STRAFE_LEFT;
keyMap[4].KeyCode = KEY_LEFT;
keyMap[5].Action = EKA_STRAFE_LEFT;
keyMap[5].KeyCode = KEY_KEY_A;
keyMap[6].Action = EKA_STRAFE_RIGHT;
keyMap[6].KeyCode = KEY_RIGHT;
keyMap[7].Action = EKA_STRAFE_RIGHT;
keyMap[7].KeyCode = KEY_KEY_D;
camera = sceneManager->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 8 );
Parameters:
parent,: Parent scene node of the camera. Can be null.
rotateSpeed,: Speed with which the camera is rotated. This can be done only with the mouse.
moveSpeed,: Speed with which the camera is moved. Movement is done with the cursor keys.
id,: id of the camera. This id can be used to identify the camera.
keyMapArray,: Optional pointer to an array of a keymap, specifying what keys should be used to move the camera. If this is null, the default keymap is used. You can define actions more then one time in the array, to bind multiple keys to the same action.
keyMapSize,: Amount of items in the keymap array.
noVerticalMovement,: Setting this to true makes the camera only move within a horizontal plane, and disables vertical movement as known from most ego shooters. Default is 'false', with which it is possible to fly around in space, if no gravity is there.
jumpSpeed,: Speed with which the camera is moved when jumping.
Returns:
Returns a pointer to the interface of the camera if successful, otherwise 0. This pointer should not be dropped. See IReferenceCounted::drop() for more information.
-
- Posts: 31
- Joined: Thu Jun 07, 2007 6:23 pm
- Location: New York
- Contact:
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
What the... I don't remember making this post. I may be drunker than I thought tonight.MasterGod wrote:Excuse me but that's the 3rd post in a row that's pretty stupid
Search the freaking forum and look on the freaking docs - WHY DO YOU THINK THEY'RE AVAILABLE FOR YA!! HA!!
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way