Hi I am making a LaserGun for my hl2dm mod and I am just trying to get the beam working first so I edited the 375 weapon code and added a constant beam that shows once the weapon is drawn,the problem I am having is that the beam is laggy when I move,here is my code can you please help me out?
void CWeapon357::ItemPostFrame( void ) { CBasePlayer *pPlayer = ToBasePlayer( GetOwner() ); // set up the vectors and traceline trace_t tr; Vector vecDir, attachpoint; QAngle vBeamAng; Vector vecSrc = pPlayer->EyePosition(); // get our view model so we can find the attachment CBaseViewModel *pViewModel = pPlayer->GetViewModel(); // get the attachment points position and angles pViewModel->GetAttachment(pViewModel->LookupAttachment("muzzle"), attachpoint, vBeamAng ); AngleVectors( vBeamAng, &vecDir); Vector vecStop = attachpoint + (vecDir * MAX_TRACE_LENGTH); // do the traceline UTIL_TraceLine( vecSrc, vecStop, MASK_ALL, pPlayer, COLLISION_GROUP_NPC, &tr ); //multiplayer needs this next line and the #endif that follows but for singleplayer remove them #ifndef CLIENT_DLL //create the beam Vector vBeamPos = attachpoint; CBeam *pBeam = CBeam::BeamCreate( "sprites/laserbeam.vmt", 0.35 ); pBeam->PointEntInit( vBeamPos, this ); pBeam->SetAbsStartPos( tr.endpos ); pBeam->SetEndAttachment( 1 ); pBeam->SetColor( 20, 20, 250 ); pBeam->SetScrollRate( 25.6 ); pBeam->SetBrightness( 30 ); pBeam->LiveForTime( 0.00001 ); #endif BaseClass::ItemPostFrame(); } _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders