// v2DScreen : 2D 화면 좌표
// plane : 화면 좌표 위치에 해당하는 점을 체크할 3D 공간상의 평면
// vPickPos : 2D 화면 좌표에 대응하는 3D 평면 상의 좌표
Ogre::Vector2 v2DScreen(100, 120);
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::Vector3 vPickPos(0, 0, 0);
unsigned int iWidth, iHeight, iColor;
int iLeft, iTop;
mWindow->getMetrics(iWidth, iHeight, iColor, iLeft, iTop);
Ogre::Ray mouseRay = mCamera->getCameraToViewportRay(v2DScreen.x/float(iWidth), v2DScreen.y/float(iHeight));
std::pair <bool, Ogre::Real> ret = mouseRay.intersects(plane);
if(ret.first)
{
vPickPos = mouseRay.getPoint(ret.second);
}
'Ogre3D' 카테고리의 다른 글
setTextureVScroll() 함수가 실행이 안 되는 경우 (0) | 2011.03.24 |
---|---|
그림자 처리에서 제외시 처리 사항 (0) | 2011.01.12 |
Ogre 쉐이더 설정 방법 - 칼라, 흑백 전환 쉐이더 코드 (0) | 2010.12.27 |
Ogre에서 화면에 2D 오브젝트 그리기 (0) | 2010.12.20 |
Ogre에서 3D 공간 좌표를 2D 화면 좌표로 변환하는 방법 (0) | 2010.12.20 |