Solved!
ok.. here is the deal ..
I was using selection function from Xavier tutorials (btw great ones)
http://artis.imag.fr/Membres/Xavier.Dec ... rial2.html
and there (in short) that function goes
void
MyApplication::mouseReleased(Ogre::MouseEvent* e)
{
if (e->getButtonID() == InputEvent::BUTTON0_MASK && e->isShiftDown()) // Shift+Left
{
// Deselect old one if any
if (mSelected) mSelected->getParentSceneNode()->showBoundingBox(false);
mWindow->setDebugText("");
// Use a ray scene query to find where we clicked
Ray mouseRay = mCamera->getCameraToViewportRay(e->getX(),e->getY());
mRaySceneQuery->setRay(mouseRay);
mRaySceneQuery->setSortByDistance(true);
RaySceneQueryResult &result = mRaySceneQuery->execute();
if (!result.empty())
{
RaySceneQueryResultEntry& re = result.front();
if (re.movable && re.movable->getMovableType() == "Entity")
{
mSelected = (Entity*)(re.movable);
mSelected->getParentSceneNode()->showBoundingBox(true);
mWindow->setDebugText("Selected "+mSelected->getName());
}
}
}
}
now..
RaySceneQueryResult &result = mRaySceneQuery->execute();
was giving all the rigt results.. BUT the first one on the list was CAMERA!
so.. when second part of code comes in
RaySceneQueryResultEntry& re = result.front();
what you do is choose a firt thing on the list (camera) and then you have a problem
ALSO .. I had to add
mCamera = mWindow->getViewport(0)->getCamera(); so I could be shure that I'm working with the camera I'm using at the moment
and of course I have changed if(!result.empty()) query to
if (!result.empty())
{
for ( itr = result.begin( ); itr != result.end(); itr++ )
{
if (itr->movable && itr->movable->getMovableType() == "Entity")
{
mSelected = (Entity*)(itr->movable);
Selected->getParentSceneNode()->showBoundingBox(true);
mWindow->setDebugText("Selected "+mSelected->getName());
break; // you found one? great! break!
}
}
}
that's all folks