We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 502c80c commit 7b2bbd1Copy full SHA for 7b2bbd1
src/view.cpp
@@ -173,6 +173,16 @@ void processRotate(glm::vec2 startP, glm::vec2 endP) {
173
float delTheta = 2.0 * dragDelta.x * moveScale;
174
float delPhi = 2.0 * dragDelta.y * moveScale;
175
176
+ // Disallow rotations that would almost align the vertical axis
177
+ glm::vec3 verticalAxis = getUpVec();
178
+ float lim = 0.01f; // controls how close to vertical the view can get
179
+ if (glm::dot(frameLookDir, verticalAxis) > 1.0 - lim) {
180
+ delPhi = std::min(delPhi, 0.0f);
181
+ }
182
+ if (glm::dot(frameLookDir, verticalAxis) < -1.0 + lim) {
183
+ delPhi = std::max(delPhi, 0.0f);
184
185
+
186
// Translate to center
187
viewMat = glm::translate(viewMat, view::viewCenter);
188
0 commit comments