本文整理汇总了C++中ogre::RaySceneQuery::clearResults方法的典型用法代码示例。如果您正苦于以下问题:C++ RaySceneQuery::clearResults方法的具体用法?C++ RaySceneQuery::clearResults怎么用?C++ RaySceneQuery::clearResults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::RaySceneQuery
的用法示例。
在下文中一共展示了RaySceneQuery::clearResults方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckAndRespawnPlayers
void Game::CheckAndRespawnPlayers()
{
// When A Player is dead, he is simply invisible
for (std::vector<RenderableChar*>::iterator ite = local_players.begin(); ite != local_players.end(); ++ite) {
if ( (*ite)->getCharState() == RenderableChar::SPAWNING ) {
std::cout << "I should respawn!" << std::endl;
(*ite)->resetVelX();
(*ite)->resetVelY();
(*ite)->setCharState(RenderableChar::IDLE);
bool free = false;
Ogre::RaySceneQuery* msq;
float x;
float y;
int c = 0;
// Here, we look for a position in the level which is collision free
// TODO: IN NARROW LEVELS, THIS CAN LEAD TO INFINITE LOOPS!
do {
if (c > 20) {
x = 10.0f;
y = 10.0f;
free = true;
}
x = Ogre::Math::RangeRandom(myLevel->getObjectSide(), myLevel->getObjectSide() * (myLevel->getWidth() -1));
y = Ogre::Math::RangeRandom(myLevel->getObjectSide(), myLevel->getObjectSide() * (myLevel->getHeight()));
std::cout << "GENX: " << x << " --- GENY: " << y << std::endl;
msq = OgreFW::getSingletonPtr()->m_pSceneMgr->createRayQuery(Ogre::Ray(Ogre::Vector3(x, y, 0.0f), Ogre::Vector3::UNIT_Y));
msq->setSortByDistance(true, 3);
//Ogre::RaySceneQuery msq->setRay(Ogre::Ray( ( (*ite)->getWorldPosition() + Ogre::Vector3(0.0f, (*ite)->getAABB().getHalfSize().y, 0.0f) ), Ogre::Vector3::UNIT_Y ));
Ogre::RaySceneQueryResult& result = msq->execute();
for (Ogre::RaySceneQueryResult::iterator itr = result.begin(); itr != result.end(); ++itr) {
if ( itr->distance >= (*ite)->getAABB().getSize().x ){
free = true;
break;
}
}
c++;
} while (free != true);
(*ite)->SetPosition(Ogre::Vector3(x, y + 0.1, 0.0f));
(*ite)->setVisible(true);
msq->clearResults();
}
}
}
示例2: Querytest
//-------------------------------------------------------------------------------------
bool RollerCoaster::Querytest()
{
Ogre::RaySceneQuery *mQuery = mSceneMgr->createRayQuery(Ogre::Ray());
Ogre::Vector3 direction =trainNode->getPosition()+
trainNode->_getDerivedOrientation()*Ogre::Vector3::UNIT_Z;
Ogre::Ray objRay( trainNode->getPosition(),direction);
mQuery->setRay(objRay);
Ogre::RaySceneQueryResult &result = mQuery->execute();
Ogre::RaySceneQueryResult::iterator iter = result.begin();
for (iter; iter!=result.end(); iter++)
{
if((*iter).movable->getName()== "mTarget")
{
return true;
}
}
mQuery->clearResults();
return false;
}