IsraelAbebe / jmonkeyengine

Automatically exported from code.google.com/p/jmonkeyengine
0 stars 0 forks source link

TouchInput/SensorInput does not integrate with InputManager #528

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
InputManager works by allowing users to register Action and Analog listeners to 
various triggers. Analog listeners allow receiving a float value per axis to 
get its current value. Action listeners are invoked when the value becomes 
non-zero, and when it becomes zero.
If one wishes to get the current mouse coordinates, they can use 
InputManager.getCursorPosition(). Another way of accessing input data is by 
using RawInputListener, which gives direct events to keyboard, mouse, and 
joystick inputs.

Unfortunately, Touch/Sensor Input and Touch/Sensor Listener are incorrectly 
implemented in InputManager. They expose an additional type of listener which 
does not work according to how AnalogListener and ActionListener work. 

A proper implementation will either handle this specialized sort of input 
out-of-band, or implement it in RawInputListener. Since touch input may include 
gestures or multiple touch-points, it is VERY difficult to implement it within 
the constraints of our current InputManager system. In addition, sensor input 
often includes absolute values, such as orientation, for which it makes no 
sense to implement within InputManager.

Therefore the recommendation is to create new methods of accessing such inputs, 
which would allow the user to directly handle them. 

For multitouch inputs, each touch can be represented as an object, with XY 
position, XY delta, and pressure. The user would assign a "tag" to this touch 
point so that they may track it. The touch point could represent a game or app 
specific object that they could manipulate.

For sensors, the orientation and position should be exposed as a separate 
listener, perhaps a "PositionListener" and "OrientationListener". Accessing 
direct sensor data can be done through a RawSensorListener which would provide 
the direct sensor values to the app.

Original issue reported on code.google.com by ShadowIs...@gmail.com on 4 Aug 2012 at 7:06

GoogleCodeExporter commented 8 years ago
So, for sensors, a seperate RawSensorListener would be available from 
InputManger that has it's own set of interfaces that are only related to sensor 
input or are we talking about a seperate manager (ie. SensorManager) that is 
completely outside of InputManager?

Original comment by potterec on 6 Aug 2012 at 4:57

GoogleCodeExporter commented 8 years ago
Sensors are taken care of.  They are now implemented as Joysticks.

Original comment by iwgeric on 17 Sep 2012 at 12:01