i have strange problem (as always )
when the orientation of the camera it is
Code: Select all
Ogre::Vector3 initorient=(Ogre::Vector3(0,0,0));
Code: Select all
Ogre::Vector3 initorient=(Ogre::Vector3(0,-45,0));
Code: Select all
Ogre::Real offsetX =(double)evt->pos().x()/(double)width();
Ogre::Real offsetY=(double) evt->pos().y()/(double)height();
mRayScnQuery = mSceneMgr->createRayQuery(Ogre::Ray());
Ogre::Ray mouseRay = mCamera->getCameraToViewportRay(offsetX, offsetY);
mRayScnQuery->setRay(mouseRay);
// Execute query
Ogre::RaySceneQueryResult &result =mRayScnQuery->execute();
Ogre::RaySceneQueryResult::iterator itr;
Ogre::RaySceneQueryResult::iterator target;
//target = itr;
float shortestDistance = -1 ;
for( itr = result.begin() ;itr != result.end();++itr)
{
if (itr->movable)
{
cout<<"name1======="<<itr->movable->getName();
if( /*dbistance iterator*/itr->distance < shortestDistance || shortestDistance < 0 )
{
// remember the closest
shortestDistance = itr->distance;
target = itr;
}
}
}
if( target->movable )
{
//add sphere
Ogre::AxisAlignedBox bb = target->movable->getBoundingBox();
QString res;
nbman++;
Ogre::SceneNode* node=target->movable->getParentSceneNode();
cout<<"name1======="<<node->getName();
cout<<"pos========"<<node->getPosition();
Ogre:: Vector3 point=mouseRay.getPoint(target->distance);
it do not dectect the node where i clic, it dectect another thing
and for this instruction
Code: Select all
cout<<"pos========"<<node->getPosition();
where is my problem?
the code does not change , just teh camera orientation