cor Posted August 29, 2011 Share Posted August 29, 2011 Hi all, I wonder if it is possible to use a 3D mouse like the 3DConnexion for: A: within Ungine Editor B: input control for the game application Link to comment
manguste Posted August 31, 2011 Share Posted August 31, 2011 Yes, it is possible, but you will need to implement custom input handling via C++ API. As for the editor, it is written in Unigine script, so it is fully customizable. Link to comment
ulf.schroeter Posted August 31, 2011 Share Posted August 31, 2011 There might be an alternative approach for 3DConnexion SpaceMouse by using their new 3DxWare software. After installation 3D mouse movements can emulate key strokes, so existing keyboard player movement can be used. Nevertheless for propper use within Unigine editor some editor script modifications where neccessary as far as I can remenber (I think for propper mapping of editor camera rotation or so) Link to comment
ulf.schroeter Posted August 31, 2011 Share Posted August 31, 2011 Had a look in my old code and actually SpaceMouse editor support used joystick emulation mode of 3DxWare. Required some modifcations of editor script file data/core/editor/editor_controls.h. Something like the following snippets namespace Controls { ..... ControlsJoystick joystick; void control() { // mouse controls ..... // impulse vec3 impulse = vec3_zero; // joystick control if( joystick != NULL ) { joystick.updateEvents(); float x_lin = joystick.getAxis(6); float y_lin = joystick.getAxis(5); float z_lin = joystick.getAxis(4); if ( y_lin > 0.1f ) impulse += z * ( y_lin - 0.1f ); else if( y_lin < -0.1f ) impulse += z * ( y_lin + 0.1f ); if ( x_lin > 0.1f ) impulse += x * ( x_lin - 0.1f ); else if( x_lin < -0.1f ) impulse += x * ( x_lin + 0.1f ); if ( z_lin > 0.1f ) impulse += y * ( z_lin - 0.1f ); else if( z_lin < -0.1f ) impulse += y * ( z_lin + 0.1f ); float x_rot = joystick.getAxis(3); float z_rot = joystick.getAxis(1); if ( x_rot > 0.1f ) theta -= 60.0f * ( x_rot - 0.1f ) * ifps; else if( x_rot < -0.1f ) theta -= 60.0f * ( x_rot + 0.1f ) * ifps; if ( z_rot > 0.1f ) phi += 60.0f * ( z_rot - 0.1f ) * ifps; else if( z_rot < -0.1f ) phi += 60.0f * ( z_rot + 0.1f ) * ifps; } // keyboard controls .... } /* */ void init() { .... for( int i=0; i<16; i++ ) { joystick = new ControlsJoystick(i); if( joystick != NULL && joystick.isAvailable() ) { break; } delete joystick; joystick = NULL; } control(); } void shutdown() { .... delete joystick; } Link to comment
Recommended Posts