Jump to content

Camera - mouse input behaviour change


Recommended Posts


In AppWorld::init I've set mouse handle to "soft", because I want to have cursor always visible:

ControlsApp::setMouseHandle( Input::MOUSE_HANDLE_SOFT );

Now to look around I must hold left mouse button - it's ok. However, I would like to have this behaviour when I'm holding right mouse button or even when I'm holding mouse wheel.
Is this possible to set somewhere? Or do I need to write my own Player inherited class?

Link to comment


You can write your own player controller, indeed (but you can't inherit from Player base class).

As a workaround you can use following code:

#include "UnigineGame.h"
#include "UnigineApp.h"
#include "UnigineControls.h"
using namespace Unigine;
using namespace Math;
Math::ivec2 old_mouse_pos;
int AppWorldLogic::update()
	ivec2 mouse_pos = ivec2(App::getMouseX(), App::getMouseY());
	vec2  mouse_dx = vec2_zero;
	if (App::getMouseButtonState(App::BUTTON_RIGHT))
		mouse_dx = vec2(mouse_pos - old_mouse_pos);
		mouse_dx *= 0.2f; // 0.2 ~ any Sensitivity constant
	auto controls = Game::getPlayer()->getControls();
	old_mouse_pos = mouse_pos;
	return 1;


How to submit a good bug report
FTP server for test scenes and user uploads:

Link to comment
  • Create New...