Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)
-
marbey
- Gnoblar
- Posts: 9
- Joined: Tue May 04, 2021 4:26 pm
- x 1
-
Quote
-
0
login to like this post
Post
by marbey »
Hello,
I have some culling problems when I rotate orthographic camera. I have an object positionned at the origin.
Code: Select all
// Initialization
pCamera = pSceneManager->createCamera("CameraMainOrthographic");
const float fScale = 1.f / 50.f;
pCamera->setNearClipDistance(0.0001f);
pCamera->setFarClipDistance(10000.f);
pCamera->setProjectionType(Ogre::ProjectionType::PT_ORTHOGRAPHIC);
pCamera->setOrthoWindow(Ogre::Real(width * fScale), Ogre::Real(height * fScale));
pCamera->setFixedYawAxis(false);
Code: Select all
// Update
m_pCamera->setOrthoWindowHeight(m_pCamera->getOrthoWindowHeight() * m_fScale);
m_pCamera->setOrthoWindowWidth(m_pCamera->getOrthoWindowWidth() * m_fScale);
m_fScale = 1.f;
m_pCamera->yaw(Ogre::Radian(m_fCameraYaw));
m_pCamera->pitch(Ogre::Radian(m_fCameraPitch));
m_fCameraYaw = 0.0f;
m_fCameraPitch = 0.0f;
Am I doing something wrong ?
-
sercero
- Bronze Sponsor
- Posts: 450
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 156
-
Quote
-
0
login to like this post
Post
by sercero »
Hello,
Could you give a graphic example of what is the problem (screen capture)?
Also:
Code: Select all
m_pCamera->yaw(Ogre::Radian(m_fCameraYaw));
m_pCamera->pitch(Ogre::Radian(m_fCameraPitch));
m_fCameraYaw = 0.0f;
m_fCameraPitch = 0.0f;
Why are you setting the variables after being used?
What values do they contain before?
Have you tried other values for NearClipDistance?
-
marbey
- Gnoblar
- Posts: 9
- Joined: Tue May 04, 2021 4:26 pm
- x 1
-
Quote
-
0
login to like this post
Post
by marbey »
Thanks,
Yes, I try to change
NearClipDistance, but it doesn't change anything.
I move the pitch and yaw with mouse move + click, I don't want the camera continue to move when I release mouse click, it works well
-
marbey
- Gnoblar
- Posts: 9
- Joined: Tue May 04, 2021 4:26 pm
- x 1
-
Quote
-
1
login to like this post
Post
by marbey »
I solved my problem by positioning the camera far away
Code: Select all
const float fScale = 1.f / 50.f;
pCamera->setProjectionType(Ogre::ProjectionType::PT_ORTHOGRAPHIC);
pCamera->setPosition(Ogre::Vector3(0, 0, 10000));
pCamera->lookAt(Ogre::Vector3(0, 0, 0));
pCamera->setNearClipDistance(.01f);
pCamera->setOrthoWindow(Ogre::Real(width * fScale), Ogre::Real(height * fScale));
Thanks for help