mRayScnQuery detect another scene node

Problems building or running the engine, queries about how to use features etc.
Post Reply
mielle
Greenskin
Posts: 113
Joined: Mon Feb 25, 2013 11:12 am
x 1

mRayScnQuery detect another scene node

Post by mielle »

Hi,
I have problem
i create character and for each bone i add a scene node in the same bones positions
but when i clic on those nodes , it detect just the character scene node

that's my code

Code: Select all

	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)
       {
		
          if( itr->distance < shortestDistance || shortestDistance  < 0 )
          {
             // remember the closest
             shortestDistance  = itr->distance;
             target = itr;
          }
       }
    }
if( target->movable )
    {
   				Ogre::AxisAlignedBox bb = target->movable->getBoundingBox();
				
				QString res;
nbman++;         

Ogre::SceneNode* node=target->movable->getParentSceneNode();
	cout<<"name1======="<<node->getName();cout<<"\n";
}
and i can't resolve it
mielle
Greenskin
Posts: 113
Joined: Mon Feb 25, 2013 11:12 am
x 1

Re: mRayScnQuery detect another scene node

Post by mielle »

Hi
i resolved the prolem just by removing this line

Code: Select all

 if( itr->distance < shortestDistance || shortestDistance  < 0 )
          {
i am not sure if this is solution or no
Post Reply