Page 1 of 1

how to handle camera ( from external input device )

Posted: Mon Jan 24, 2011 6:33 am
by nuc_lear
(SOLVED)

Irrlicht's examples' camera moves with left-up-right-down arrow key buttons and rotates.. with mouse.

How i can, move on( key W ), move back( S ), rotate right( D ) and rotate left( A ).I need only that four acts.

Posted: Mon Jan 24, 2011 7:45 am
by lazerblade
Try the manual here

http://irrlicht.sourceforge.net/docu/cl ... 80f2cdddbb

It has exactly what you are asking about W,A,S,D.

Posted: Mon Jan 24, 2011 10:45 pm
by nuc_lear
Actually my question is : how can i handle the camera like keyboard from my external input device( glove with sensors ) which sends rotate and move values..?

@lazerblade thank for reply.The code below solves the WASD.

SKeyMap keyMap[10];
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;

keyMap[8].Action = EKA_JUMP_UP;
keyMap[8].KeyCode = KEY_KEY_J;

keyMap[9].Action = EKA_CROUCH;
keyMap[9].KeyCode = KEY_KEY_C;

camera = smgr->addCameraSceneNodeFPS(0, 100.0f, 0.6f, -1, keyMap, 10, false, 0.6f);

Posted: Tue Jan 25, 2011 10:23 pm
by nuc_lear
I solved the problem with system's mouse and keyboard event simulate functions :)
( keybd_event(VkKeyScan('W'),0x9e,0,0); )