I've created necessary object and rotated it by 30 degree on each of the
Code: Select all
ogreNode->rotate(Ogre::Quaternion(Ogre::Degree(30), Ogre::Vector3(1, 1, 1)), Ogre::Node::TransformSpace::TS_WORLD);
Code: Select all
MouseClicky(unsigned int absoluteX, unsigned int absoluteY) {
float width = (float) this->cam->getViewport()->getActualWidth(); // viewport width
float height = (float) this->cam->getViewport()->getActualHeight(); // viewport height
Ray ray = this->cam->getCameraToViewportRay((float)absoluteX / width, (float)absoluteY / height);
// Set up the ray query - you will probably not want to create this every time
RaySceneQuery * rq = this->scnMgr->createRayQuery(ray);
// Sort by distance, and say we're only interested in the first hit; also, only pick entities
rq->setSortByDistance(true, 1);
// Execute
RaySceneQueryResult res = rq->execute();
RaySceneQueryResult::iterator it = res.begin();
// these two things should probably be encapsulated in their own class/struct
if (it != res.end())
{
printf("clicked: %s\n",it->movable->getName().c_str());
}
else
{
printf("cleared selection.\n");
}
this->scnMgr->destroyQuery(rq);
}

Does anyone has any idea what is the issues ?