Topic: SKeymap and addCameraSceneNodeFPS

Hi,

Can someone tell me how to change the default keys for AddCameraSceneNodeFPS. I want to change the arrow keys to standard WASD but am having trouble doing this. I've tried doing doing this as per tutorial on the Irrlicht Wiki but it doesn't seem to work.

Re: SKeymap and addCameraSceneNodeFPS

greetings smile  the BMAX call to addCameraSceneNodeFPS is slightly different than the C++ call.  instead of having to pass the # of keys i take advantage of BMAX and you just need to pass a BMAX array of SKeyMap objects.  another difference is that the mod uses setters/getters to access properties so the action and keycode properties on SKeyMap become get/setAction and get/setKeyCode.  the code would look something like (this is untested):

Local keyMap:SKeyMap[8]

' we must create an instance using the create method
keyMap[0] = SKeyMap.create()
keyMap[0].setAction(EKA_MOVE_FORWARD)
keyMap[0].setKeyCode(EKEY_KEY_UP)

keyMap[1] = SKeyMap.create()
keyMap[1].setAction(EKA_MOVE_FORWARD)
keyMap[1].setKeyCode(EKEY_KEY_W)

keyMap[2] = SKeyMap.create()
keyMap[2].setAction(EKA_MOVE_BACKWARD)
keyMap[2].setKeyCode(EKEY_KEY_DOWN)

keyMap[3] = SKeyMap.create()
keyMap[3].setAction(EKA_MOVE_BACKWARD)
keyMap[3].setKeyCode(EKEY_KEY_S)

keyMap[4] = SKeyMap.create()
keyMap[4].setAction(EKA_STRAFE_LEFT)
keyMap[4].setKeyCode(EKEY_KEY_LEFT)

keyMap[5] = SKeyMap.create()
keyMap[5].setAction(EKA_STRAFE_LEFT)
keyMap[5].setKeyCode(EKEY_KEY_A)

keyMap[6] = SKeyMap.create()
keyMap[6].setAction(EKA_STRAFE_RIGHT)
keyMap[6].setKeyCode(EKEY_KEY_RIGHT)

keyMap[7] = SKeyMap.create()
keyMap[7].setAction(EKA_STRAFE_RIGHT)
keyMap[7].setKeyCode(EKEY_KEY_D)

' now you should just need to call the command
Local cam:ICameraSceneNode = smgr.addCameraSceneNodeFPS(Null, 100, .5, -1, keyMap)

3 (edited by Kronos 2009-09-18 10:08:02)

Re: SKeymap and addCameraSceneNodeFPS

Yep that worked perfectly.Thanks