Skip to main content

History: How to limit the pitch of a camera

Source of version: 4

Copy to clipboard
            This is just a code snippet taken from this post on the forums: [http://www.ogre3d.org/phpBB2/viewtopic.php?t=10325|Link to forum post].

{CODE(wrap="1", colors="c++")} 
iCamera->yaw(iRotX);
Ogre::Radian originalPitch = iCamera->getOrientation().getPitch();
Ogre::Radian newPitch = Ogre::Math::Abs(iRotY + originalPitch);
 
if(newPitch < Ogre::Radian(Ogre::Math::PI/2 - Offset) || newPitch > Ogre::Radian(Ogre::Math::PI/2 + Offset))
{
     iCamera->pitch(iRotY);         
}{CODE}

__Note:__ A correct offset value must be around 0.2 - 0.5.


        

History

Information Version
Mon 17 of Dec, 2012 17:19 GMT-0000 drwbns 6
Fri 19 of Aug, 2011 18:20 GMT-0000 jacmoe 5
Thu 05 of Aug, 2010 23:21 GMT-0000 spacegaier cleaned it up 4
Sat 02 of Jan, 2010 07:48 GMT-0000 jacmoe 3
Fri 25 of Dec, 2009 01:14 GMT-0000 jacmoe 2
Wed 28 of Jan, 2009 22:33 GMT-0000 Beauty corrected mistype + corrected link to renamed page [[CodeSnippets]] 1