Skip to content

Commit

Permalink
Prevent going up when rotating camera with ctrl and reaching pitch li…
Browse files Browse the repository at this point in the history
…mits
  • Loading branch information
wonder-sk committed Jun 29, 2018
1 parent e073a4c commit e35ec2d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/3d/qgscameracontroller.cpp
Expand Up @@ -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
Expand Down

0 comments on commit e35ec2d

Please sign in to comment.