To get ray intersect on worldGeometry is can be read here (http://www.ogre3d.org/tikiwiki/Intermediate+Tutorial+2&structure=Tutorials), but if Terrain or TerrainGroup is used, the code will be slightly different:
Ogre::Vector3 camPos = mCamera->getPosition();
Ogre::Terrain* pTerrain = mTerrainGroup->getTerrain(0, 0);
Ogre::Ray mouseRay(Ogre::Vector3(camPos.x, 5000.0f, camPos.z), Ogre::Vector3::NEGATIVE_UNIT_Y);
std::pair <bool, Ogre::Vector3> test;
test = pTerrain->rayIntersects(mouseRay, true, 0);
if (test.first)
{
// do something
}
On the code above, instead RaySceneQUery, RayIntersect is used, a variable std::pair <bool, Ogre::Vector3> is used to store value of RayIntersects function, use test.fisrt to check if the Ray intersect with terrain, and test.second to get intersection point of Vector3.





