Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all
Unified · Split
| @@ -183,6 +183,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 182 unmodified lines | ||
| 183 | 183 | _touchAvgX(0.0f), |
| 184 | 184 | _touchAvgY(0.0f), |
| 185 | 185 | _isTouchPressed(false), |
| 186 | + _yawFromTouch(0.0f), | |
| 187 | + _pitchFromTouch(0.0f), | |
| 186 | 188 | _mousePressed(false), |
| 187 | 189 | _mouseVoxelScale(1.0f / 1024.0f), |
| 188 | 190 | _justEditedVoxel(false), |
| @@ -969,6 +971,9 @@ void Application::idle() { · 780 unmodified lines | ||
| 969 | 971 | gettimeofday(&check, NULL); |
| 970 | 972 | |
| 971 | 973 | // Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran |
| 974 | + sendPostedEvents(NULL, QEvent::TouchBegin); | |
| 975 | + sendPostedEvents(NULL, QEvent::TouchUpdate); | |
| 976 | + sendPostedEvents(NULL, QEvent::TouchEnd); | |
| 972 | 977 | |
| 973 | 978 | double timeSinceLastUpdate = diffclock(&_lastTimeUpdated, &check); |
| 974 | 979 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { |
| @@ -978,9 +983,6 @@ void Application::idle() { · 3 unmodified lines | ||
| 978 | 983 | // This is necessary because id the idle() call takes longer than the |
| 979 | 984 | // interval between idle() calls, the event loop never gets to run, |
| 980 | 985 | // and touch events get delayed. |
| 981 | − sendPostedEvents(NULL, QEvent::TouchBegin); | |
| 982 | − sendPostedEvents(NULL, QEvent::TouchUpdate); | |
| 983 | − sendPostedEvents(NULL, QEvent::TouchEnd); | |
| 984 | 986 | |
| 985 | 987 | const float BIGGEST_DELTA_TIME_SECS = 0.25f; |
| 986 | 988 | update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); |
| @@ -1902,12 +1904,9 @@ void Application::update(float deltaTime) { · 915 unmodified lines | ||
| 1902 | 1904 | if (_isTouchPressed) { |
| 1903 | 1905 | float TOUCH_YAW_SCALE = -50.0f; |
| 1904 | 1906 | float TOUCH_PITCH_SCALE = -50.0f; |
| 1905 | − _myAvatar.getHead().addYaw((_touchAvgX - _lastTouchAvgX) | |
| 1906 | − * TOUCH_YAW_SCALE | |
| 1907 | − * deltaTime); | |
| 1908 | − _myAvatar.getHead().addPitch((_touchAvgY - _lastTouchAvgY) | |
| 1909 | − * TOUCH_PITCH_SCALE | |
| 1910 | − * deltaTime); | |
| 1907 | + _yawFromTouch += ((_touchAvgX - _lastTouchAvgX) * TOUCH_YAW_SCALE * deltaTime); | |
| 1908 | + _pitchFromTouch += ((_touchAvgY - _lastTouchAvgY) * TOUCH_PITCH_SCALE * deltaTime); | |
| 1909 | + | |
| 1911 | 1910 | _lastTouchAvgX = _touchAvgX; |
| 1912 | 1911 | _lastTouchAvgY = _touchAvgY; |
| 1913 | 1912 | } |
| @@ -2015,7 +2014,9 @@ void Application::updateAvatar(float deltaTime) { · 101 unmodified lines | ||
| 2015 | 2014 | _myAvatar.updateFromGyrosAndOrWebcam(_gyroLook->isChecked(), |
| 2016 | 2015 | glm::vec3(_headCameraPitchYawScale, |
| 2017 | 2016 | _headCameraPitchYawScale, |
| 2018 | − _headCameraPitchYawScale)); | |
| 2017 | + _headCameraPitchYawScale), | |
| 2018 | + _yawFromTouch, | |
| 2019 | + _pitchFromTouch); | |
| 2019 | 2020 | |
| 2020 | 2021 | if (_serialHeadSensor.isActive()) { |
| 2021 | 2022 | |