Pierre_Bultingaire Posted September 22, 2022 Share Posted September 22, 2022 Hello, Is it possible to map a control of a camera on two different keys? I would like to be able to use both W and the Up arrow. When I try Unigine::ControlsApp::setStateKey(Unigine::Controls::STATE_FORWARD, Unigine::Input::KEY_Z ); Unigine::ControlsApp::setStateKey(Unigine::Controls::STATE_FORWARD, Unigine::Input::KEY_UP ); It will of course erase the first setState. Thanks, Pierre Link to comment
karpych11 Posted September 23, 2022 Share Posted September 23, 2022 Hello, In Controls you can't map two buttons to the same state. In this case you can try using ControlsDummy. class AppWorldLogic: public Unigine::WorldLogic { //...... private: Unigine::ControlsDummyPtr custom_control; //...... }; int AppWorldLogic::init() { //...... custom_control = ControlsDummy::create(); PlayerPtr player = Game::getPlayer(); if (player) player->setControls(custom_control); //...... } int AppWorldLogic::update() { //...... custom_control->setState(Controls::STATE_FORWARD, Input::isKeyPressed(Input::KEY_W) || Input::isKeyPressed(Input::KEY_UP)); custom_control->setState(Controls::STATE_BACKWARD, Input::isKeyPressed(Input::KEY_S) || Input::isKeyPressed(Input::KEY_DOWN)); custom_control->setState(Controls::STATE_MOVE_LEFT, Input::isKeyPressed(Input::KEY_A) || Input::isKeyPressed(Input::KEY_LEFT)); custom_control->setState(Controls::STATE_MOVE_RIGHT, Input::isKeyPressed(Input::KEY_D) || Input::isKeyPressed(Input::KEY_RIGHT)); custom_control->setState(Controls::STATE_CROUCH, Input::isKeyPressed(Input::KEY_Q)); custom_control->setState(Controls::STATE_JUMP, Input::isKeyPressed(Input::KEY_E)); custom_control->setState(Controls::STATE_RUN, Input::isKeyPressed(Input::KEY_SHIFT)); custom_control->setMouseDX(Input::getMouseDelta().x); custom_control->setMouseDY(Input::getMouseDelta().y); //...... } 1 Link to comment
Recommended Posts