How to limit the pitch of a camera         Useful snippet to clamp the camera pitch
Print

This is just a code snippet taken from this post on the forums: Link to forum post.

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);         
}

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


Alias: How_to_limit_the_pitch_of_a_camera


Contributors to this page: jacmoe111451 points  , spacegaier3733 points  and Beauty5965 points  .
Page last modified on Friday 19 of August, 2011 18:20:30 GMT by jacmoe111451 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.