void moveCamera() ... { mLastPosition=mCamera->getPosition(); mCamera->yaw(mRotX); mCamera->pitch(mRotY); mCamera->moveRelative(mTranslateVector); //创建一个球体查询,这里的10是m_SphereNode挂着的那个球体的半径 SphereSceneQuery* pQuery=mSceneMgr->createSphereQuery(Sphere(mCamera->getPosition(),10)); //执行这个查询 SceneQueryResult QResult=pQuery->execute(); //遍历查询列表找出范围内的物体 for (std::list<MovableObject*>::iterator iter = QResult.movables.begin(); iter != QResult.movables.end();++iter) ...{ MovableObject* pObject=static_cast<MovableObject*>(*iter); if(pObject) ...{ if(pObject->getMovableType()=="Entity") ...{ mCamera->setPosition(mLastPosition); //if(ent->getName()=="Head") //{ // MessageBox(NULL,"a","df",MB_OK); //break; //} } } }}