bool mousePressed( const OIS::MouseEvent & arg, OIS::MouseButtonID id ) ... { if (id == OIS::MB_Left) ...{ onLeftPressed(arg); } CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id)); return true;} void onLeftPressed( const OIS::MouseEvent & arg) ... { // Create RaySceneQuery RaySceneQuery *mRaySceneQuery = mSceneMgr->createRayQuery(Ray()); // Setup the ray scene query CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition(); Ray mouseRay = mCamera->getCameraToViewportRay(mousePos.d_x/float(arg.state.width), mousePos.d_y/float(arg.state.height)); mRaySceneQuery->setRay(mouseRay); mRaySceneQuery->setSortByDistance(true); // Execute query RaySceneQueryResult result = mRaySceneQuery->execute(); RaySceneQueryResult::iterator itr; for ( itr = result.begin(); itr != result.end(); itr++ ) ...{ if (itr->movable->getName()=="Head")//如果点中物体名为Head ...{ MessageBox(NULL,"Head","asdf",MB_OK); break; } }}