First, open EffectLib/EffectInstance.h and add this to CEffectInstance class: const D3DXMATRIX& GetGlobalMatrix() const { return m_matGlobal; }; Now go to GameLib/Area.cpp and add these to the includes #include "../UserInterface/StdAfx.h" #include "../UserInterface/PythonCharacterManager.h" #include "../UserInterface/PythonBackground.h" Now modify CArea::__UpdateEffectList function to look like this void CArea::__UpdateEffectList() { int peNum; float pfStart, pfEnd, pfFarClip; D3DXVECTOR3 chrPos; CPythonBackground::instance().GetDistanceSetInfo(&peNum, &pfStart, &pfEnd, &pfFarClip); CInstanceBase* pInst = CPythonCharacterManager::instance().GetMainInstancePtr(); if (!pInst) return; chrPos = pInst->GetGraphicThingInstanceRef().GetPosition(); CEffectManager& rkEftMgr=CEffectManager::Instance(); TEffectInstanceIterator i; for (i = m_EffectInstanceMap.begin(); i != m_EffectInstanceMap.end();) { CEffectInstance * pEffectInstance = i->second; const D3DMATRIX& gMatrix = pEffectInstance->GetGlobalMatrix(); if (pfStart < GetPixelPositionDistance(chrPos, TPixelPosition(gMatrix._41, gMatrix._42, gMatrix._43))) { pEffectInstance->Hide(); ++i; continue; } pEffectInstance->Show(); pEffectInstance->Update(); if (!pEffectInstance->isAlive()) { i = m_EffectInstanceMap.erase(i); rkEftMgr.DestroyUnsafeEffectInstance(pEffectInstance); } else { ++i; } } }