mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 10:45:24 +02:00
Android - Improve View controller making it like a drag rather than like a joystick (reference touch is updated at every frame and is not only the initial touch anymore)
This commit is contained in:
parent
67ae6aee33
commit
b87a07a7d0
3 changed files with 7 additions and 3 deletions
|
@ -7,6 +7,6 @@
|
|||
|
||||
{ "from": "TouchscreenVirtualPad.RX", "when": "!Application.CameraIndependent", "filters": [ {"type": "deadZone", "min": 0.05} , "invert" ], "to": "Actions.Yaw" },
|
||||
|
||||
{ "from": "TouchscreenVirtualPad.RY", "when": "!Application.CameraIndependent", "filters": [ "invert" ], "to": "Actions.Pitch" }
|
||||
{ "from": "TouchscreenVirtualPad.RY", "when": "!Application.CameraIndependent", "filters": [ {"type": "deadZone", "min": 0.05}, "invert" ], "to": "Actions.Pitch" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -138,10 +138,13 @@ void TouchscreenVirtualPadDevice::processInputDeviceForView() {
|
|||
|
||||
// NOW BETWEEN -1 1
|
||||
rightDistanceScaleX /= STICK_RADIUS_INCHES;
|
||||
rightDistanceScaleY /= STICK_RADIUS_INCHES*2; // pitch is slower
|
||||
rightDistanceScaleY /= STICK_RADIUS_INCHES;
|
||||
|
||||
_inputDevice->_axisStateMap[controller::RX] = rightDistanceScaleX;
|
||||
_inputDevice->_axisStateMap[controller::RY] = rightDistanceScaleY;
|
||||
|
||||
// after use, save last touch point as ref
|
||||
_viewRefTouchPoint = _viewCurrentTouchPoint;
|
||||
}
|
||||
|
||||
void TouchscreenVirtualPadDevice::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
|
||||
|
@ -343,6 +346,7 @@ void TouchscreenVirtualPadDevice::viewTouchBegin(glm::vec2 touchPoint) {
|
|||
auto& virtualPadManager = VirtualPad::Manager::instance();
|
||||
if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) {
|
||||
_viewRefTouchPoint = touchPoint;
|
||||
_viewCurrentTouchPoint = touchPoint;
|
||||
_viewHasValidTouch = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
class QTouchEvent;
|
||||
class QGestureEvent;
|
||||
|
||||
const float STICK_RADIUS_INCHES = 1.0f;
|
||||
const float STICK_RADIUS_INCHES = .3f;
|
||||
|
||||
class TouchscreenVirtualPadDevice : public InputPlugin {
|
||||
Q_OBJECT
|
||||
|
|
Loading…
Reference in a new issue