Working on third-person muzzle flashes, I have encountered an issue. I am unable to _RELIABLY_ get the third-person (world) muzzle flashes to shoot from the proper origin or angles. The interesting portion of this is that the muzzle flashes will work reliably for a brief period of time, after which the origin and angles get way off base. Once the muzzle flash stops working it won't work again until a new server is created.
Anyone have any possible idea as to what would be causing this? I've tried several different methods concerning this. Below is some code: Sever-Side: int nMuzzleAttachment = LookupAttachment("muzzle"); muzzleFlash.m_nEntIndex = entindex(); muzzleFlash.m_fFlags = GetWeaponID(); muzzleFlash.m_nAttachmentIndex = nMuzzleAttachment; DispatchEffect("MuzzleFlash", muzzleFlash); Client-Side Rendering Code: void CForsakenTempEnts::MuzzleFlash(const Vector &rvecPosition, const QAngle &rAngles, int nType, int nEntIndex, bool bFirstPerson) /* A quick sample for testing third-person muzzle flashes. Pre: Muzzle flash information received correctly, !bFirstPerson. Post: A sample muzzle flash should appear for third-person only. *NOTE* This function is only reached when the MuzzleFlash effect is dispatched. */ { VPROF_BUDGET("MuzzleFlash_ThirdPerson_Sample", VPROF_BUDGETGROUP_PARTICLE_RENDERING); CSmartPtr<CSimpleEmitter> pMuzzleFlash = CSimpleEmitter::Create("MuzzleFlash_ThirdPerson_Sample "); float fScale = random->RandomFloat(1.25f, 1.5f); SimpleParticle *pParticle = NULL; Vector vecForward, vecOffset; // Fetch the forward. AngleVectors(rAngles, &vecForward); for (int i = 1; i < 6; i++) { // Calculate the muzzle flash offset. vecOffset = (vecForward * (i * 8.0f * fScale)) + rvecPosition; // Create the particle. pParticle = (SimpleParticle*)pMuzzleFlash->AddParticle(sizeof(SimpleParticle), pMuzzleFlash->GetPMaterial("effects/muzzleflash1"), vecOffset); // Not able to create any more particles. if (!pParticle) return; // Set the life time, death time, and velocity. pParticle->m_flLifetime = 0.0f; pParticle->m_flDieTime = 0.025f; pParticle->m_vecVelocity.Init(); // Set the color. pParticle->m_uchColor[0] = 255; pParticle->m_uchColor[1] = 255; pParticle->m_uchColor[2] = 255; // Start and end alpha. pParticle->m_uchEndAlpha = 255; pParticle->m_uchStartAlpha = 255; // Set the start and end size (10% of original size). pParticle->m_uchStartSize = 7; pParticle->m_uchEndSize = (unsigned char)(pParticle->m_uchStartSize * 0.90); // Set the particle roll. pParticle->m_flRoll = random->RandomInt(0, 360); pParticle->m_flRollDelta = 0.0; } } _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders