// 把一个物体放到指定得摄影机位置 void CFakeObjectEntityManager::CreateObject(LPCTSTR szObjName, CObjEntityActor* pNode, CObjEntityActor* pAttachNode, LPCTSTR szCameraName, int nTexWidth, int nTexHeight, LPCTSTR szBackgroundName) { // 先根据该fake object的名称来获取摆放位置 m_fvPosition = Ogre::Vector3(_GetFakeObjPos(szObjName), 10000.f, 0.f); //物体不存在,创建新的渲染环境 FakeObjectMap::iterator it = _GetFakeNode(szObjName, pNode, szCameraName, nTexWidth, nTexHeight, szBackgroundName); if(it == m_mapObject.end()) return; it->second.pEntityNode = pNode; it->second.pAttachEntityNode = pAttachNode; //将需要渲染的实体放入渲染环境中 // 如果骑在马上的,要设置马的位置,把人的位置复位 Fairy::LogicModel* modelImpl = pNode->GetActorImpl(); if (modelImpl->isAttached()) { Fairy::LogicModel* parentModel = modelImpl->getAttachModel(); KLAssert (parentModel); modelImpl->setPosition(Ogre::Vector3(0.0f, 0.0f, 0.0f)); parentModel->setPosition(Ogre::Vector3(m_fvPosition.x, m_fvPosition.y, m_fvPosition.z)); parentModel->setVisible(true); } else pNode->SetGfxPosition(fVector3(m_fvPosition.x, m_fvPosition.y, m_fvPosition.z)); //初始就显示,在运行过程中会一直保持visible为true的状态 pNode->SetVisible(TRUE); }