ndoxx
13-03-2008 14:42:45
Hi,
I have problem with selecting object in PLSM with rayscenequery. My code for selecting movable objects is here :
It worked well with my previous application using Terrain Scene Manager, but doesn't work with application using PLSM.
The problem is my RaySceneQueryResult always contains only one result, which is the world fragment and never the movable object. If an object clicked, the RaySceneQueryResult(t_Result variable) will contain only the world fragment intersection clicked, but not the movable object(s) clicked.
does it somehow related with PLSM? because with other scenemanager it worked well
Thanks.
Ndoxx.
I have problem with selecting object in PLSM with rayscenequery. My code for selecting movable objects is here :
std::cout << "Raycasting . . ." << std::endl;
Ray t_MouseRay = ((MapOgre*)(Game::GetSingletonPtr()->GetActiveMap()))->GetCamera()->getCameraToViewportRay(((float)m_PointerPosition.X/p_Evt.state.width), ((float)m_PointerPosition.Y/p_Evt.state.height));
m_RaySceneQuery->setRay(t_MouseRay);
m_RaySceneQuery->setWorldFragmentType(SceneQuery::WFT_SINGLE_INTERSECTION);
//std::cout << "Query Mask " << m_RaySceneQuery->getQueryMask();
RaySceneQueryResult& t_Result = m_RaySceneQuery->execute();
std::cout << "done, iterating result with " << t_Result.size() << " intersection";
for (RaySceneQueryResult::iterator t_Itr = t_Result.begin(); t_Itr != t_Result.end(); t_Itr++)
{
if (t_Itr->worldFragment)
{
// handling code
}
else if (t_Itr->movable)
{
// handling code
}
std::cout << std::endl << "done iterating result" << std::endl;
}
It worked well with my previous application using Terrain Scene Manager, but doesn't work with application using PLSM.
The problem is my RaySceneQueryResult always contains only one result, which is the world fragment and never the movable object. If an object clicked, the RaySceneQueryResult(t_Result variable) will contain only the world fragment intersection clicked, but not the movable object(s) clicked.
does it somehow related with PLSM? because with other scenemanager it worked well
Thanks.
Ndoxx.