How to limit the pitch of a camera
Useful snippet to clamp the camera pitch
Welcome to the new Ogre Wiki!
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
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: jacmoe
,
spacegaier
and
Beauty
.
Page last modified on Friday 19 of August, 2011 18:20:30 GMT by jacmoe
.
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.
Sidebar
Search box
Online users
97
online users

