Skip to content
Permalink
Browse files

Prevent going up when rotating camera with ctrl and reaching pitch li…

…mits
  • Loading branch information
wonder-sk committed Jun 29, 2018
1 parent e073a4c commit e35ec2dccb9b076057bb6ebb1b1d778d0250cec4
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/3d/qgscameracontroller.cpp
@@ -241,6 +241,11 @@ QPointF screen_point_to_point_on_plane( const QPointF &pt, const QRect &viewport

void QgsCameraController::rotateCamera( float diffPitch, float diffYaw )
{
if ( mCameraData.pitch + diffPitch > 80 )
diffPitch = 80 - mCameraData.pitch; // prevent going under the plane
if ( mCameraData.pitch + diffPitch < 0 )
diffPitch = 0 - mCameraData.pitch; // prevent going over the head

// Is it always going to be love/hate relationship with quaternions???
// This quaternion combines two rotations:
// - first it undoes the previously applied rotation so we have do not have any rotation compared to world coords

0 comments on commit e35ec2d

Please sign in to comment.
You can’t perform that action at this time.