mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 10:45:24 +02:00
Android View control - Remove limit, use a scale filter, remove deadZone to increase sensitivity
This commit is contained in:
parent
b61a436a84
commit
1a967e45a6
3 changed files with 19 additions and 20 deletions
|
@ -7,8 +7,23 @@
|
|||
|
||||
{ "from": "TouchscreenVirtualPad.JUMP_BUTTON_PRESS", "when": "!Application.CameraIndependent", "to": "Actions.VERTICAL_UP" },
|
||||
|
||||
{ "from": "TouchscreenVirtualPad.RX", "when": "!Application.CameraIndependent", "filters": [ {"type": "deadZone", "min": 0.05} , "invert" ], "to": "Actions.Yaw" },
|
||||
{ "from": "TouchscreenVirtualPad.RX", "when": "!Application.CameraIndependent",
|
||||
"filters": [
|
||||
{ "type": "deadZone", "min": 0.000 },
|
||||
{ "type": "scale", "scale": 0.014175 },
|
||||
"invert"
|
||||
],
|
||||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
{ "from": "TouchscreenVirtualPad.RY", "when": "!Application.CameraIndependent",
|
||||
"filters": [
|
||||
{ "type": "deadZone", "min": 0.000 },
|
||||
{ "type": "scale", "scale": 0.014175 },
|
||||
"invert"
|
||||
],
|
||||
"to": "Actions.Pitch"
|
||||
}
|
||||
|
||||
{ "from": "TouchscreenVirtualPad.RY", "when": "!Application.CameraIndependent", "filters": [ {"type": "deadZone", "min": 0.05}, "invert" ], "to": "Actions.Pitch" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -137,20 +137,8 @@ void TouchscreenVirtualPadDevice::processInputDeviceForMove(VirtualPad::Manager&
|
|||
}
|
||||
|
||||
void TouchscreenVirtualPadDevice::processInputDeviceForView() {
|
||||
float rightDistanceScaleX, rightDistanceScaleY;
|
||||
rightDistanceScaleX = (_viewCurrentTouchPoint.x - _viewRefTouchPoint.x) / _screenDPIScale.x;
|
||||
rightDistanceScaleY = (_viewCurrentTouchPoint.y - _viewRefTouchPoint.y) / _screenDPIScale.y;
|
||||
|
||||
rightDistanceScaleX = clip(rightDistanceScaleX, -_viewStickRadiusInches, _viewStickRadiusInches);
|
||||
rightDistanceScaleY = clip(rightDistanceScaleY, -_viewStickRadiusInches, _viewStickRadiusInches);
|
||||
|
||||
// NOW BETWEEN -1 1
|
||||
rightDistanceScaleX /= _viewStickRadiusInches;
|
||||
rightDistanceScaleY /= _viewStickRadiusInches;
|
||||
|
||||
_inputDevice->_axisStateMap[controller::RX] = rightDistanceScaleX;
|
||||
_inputDevice->_axisStateMap[controller::RY] = rightDistanceScaleY;
|
||||
|
||||
_inputDevice->_axisStateMap[controller::RX] = _viewCurrentTouchPoint.x - _viewRefTouchPoint.x;
|
||||
_inputDevice->_axisStateMap[controller::RY] = _viewCurrentTouchPoint.y - _viewRefTouchPoint.y;
|
||||
// after use, save last touch point as ref
|
||||
_viewRefTouchPoint = _viewCurrentTouchPoint;
|
||||
}
|
||||
|
@ -396,7 +384,6 @@ void TouchscreenVirtualPadDevice::jumpTouchBegin(glm::vec2 touchPoint) {
|
|||
|
||||
auto input = _inputDevice->makeInput(TouchButtonChannel::JUMP_BUTTON_PRESS);
|
||||
_inputDevice->_buttonPressedMap.insert(input.getChannel());
|
||||
qDebug() << "[TVPD] TouchscreenVirtualPadDevice::jumpTouchBegin buttonsMapSize " << _inputDevice->_buttonPressedMap.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,7 +395,6 @@ void TouchscreenVirtualPadDevice::jumpTouchEnd() {
|
|||
|
||||
auto input = _inputDevice->makeInput(TouchButtonChannel::JUMP_BUTTON_PRESS);
|
||||
_inputDevice->_buttonPressedMap.erase(input.getChannel());
|
||||
qDebug() << "[TVPD] TouchscreenVirtualPadDevice::jumpTouchEnd buttonsMapSize " << _inputDevice->_buttonPressedMap.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,8 +115,6 @@ protected:
|
|||
glm::vec2 _jumpButtonPosition;
|
||||
float _jumpButtonRadius;
|
||||
|
||||
float _viewStickRadiusInches {0.1333f}; // agreed default
|
||||
|
||||
void moveTouchBegin(glm::vec2 touchPoint);
|
||||
void moveTouchUpdate(glm::vec2 touchPoint);
|
||||
void moveTouchEnd();
|
||||
|
|
Loading…
Reference in a new issue