I'm guessing you want this gun to do damage through walls too then eh? If so, instead of changing your DrawBeam() function, try modifiying the UTIL_Trace() that gives you that tr.endpos past the wall. That probably means changing the MASK_SOLID to ( CONTENTS_HITBOX | CONTENTS_MONSTER ), so the trace goes thorugh everything except bad guys.
On 4/13/05, Michael Kramer <[EMAIL PROTECTED]> wrote: > Still doesn't work, it freezes the game sometimes, and the beam still > doesn't go through, and sometimes the beam comes from the middle of > the screen....I have fooled around with it but nothing works :( Oh > well....any other ideas? > > On 4/12/05, NuclearFriend <[EMAIL PROTECTED]> wrote: > > -- > > [ Picked text/plain from multipart/alternative ] > > Ok then, well one way would be to use botmans method, except replace his > > start_position with tr.startpos. Then ensure the second beam you call has a > > startpos of tr.endpos, and an endpos of the scaled new vector. > > > > So, > > > > /* start here */ > > > > DrawBeam( startPos, tr.endpos, 9.6, false); //the last parameter is if you > > want the beam to come > > //from the "muzzle" attachment. this should be false (assuming startPos is > > defined) > > > > if ( penetrated ) > > { > > Vector v_newbeam = tr.endpos - tr.startpos; > > VectorNormalize(v_newbeam); > > v_newbeam = v_newbeam * 1000; // scale the vector up to the length in units > > you want > > Vector v_beamend = tr.endpos + v_newbeam; > > > > DrawBeam( tr.endpos, v_beamend, 9.6, false ); > > } > > > > /* end here */ > > > > Good luck. :> > > > > On Apr 12, 2005 10:55 AM, Michael Kramer <[EMAIL PROTECTED]> wrote: > > > > > > Ok, I am actually creating the Gauss Gun....and I have everything > > > working except when the beam shoots through walls....this is what I > > > have > > > > > > I have it so that if penetrated = true then it will draw the beam > > > using this function > > > > > > DrawBeam( startposition,endposition,width, whether or not I use the Muzzle > > > ) > > > > > > So basically I have it > > > DrawBeam( startPos, tr.endpos, 9.6, true ); For normal but I want to > > > so that it then creats another beam at the end so it would be like > > > DrawBeam( tr.endpos, beyond!!, 9.6, false ); > > > But it doesn't work I do not know how to tell it to go past > > > tr.endpos.....By using Broome's method, it creats two beams both > > > coming from the muzzle even with muzzle set to false. > > > > > > The draw beam code is here: > > > > > > void CWeaponGaussGun::DrawBeam( const Vector &startPos, const Vector > > > &endPos, float width, bool useMuzzle ) > > > { > > > CBasePlayer *pOwner = ToBasePlayer( GetOwner() ); > > > > > > if ( pOwner == NULL ) > > > return; > > > > > > //Check to store off our view model index > > > if ( m_hViewModel == NULL ) > > > { > > > CBaseViewModel *vm = pOwner->GetViewModel(); > > > > > > if ( vm ) > > > { > > > m_hViewModel.Set( vm ); > > > } > > > } > > > > > > //Draw the main beam shaft > > > CBeam *pBeam = CBeam::BeamCreate( GAUSS_BEAM_SPRITE, width ); > > > > > > if ( useMuzzle ) > > > { > > > pBeam->PointEntInit( endPos, m_hViewModel ); > > > pBeam->SetEndAttachment( 1 ); > > > pBeam->SetWidth( width / 4.0f ); > > > pBeam->SetEndWidth( width ); > > > } > > > else > > > { > > > pBeam->SetStartPos( startPos ); > > > pBeam->SetEndPos( endPos ); > > > pBeam->SetWidth( width ); > > > pBeam->SetEndWidth( width / 4.0f ); > > > } > > > > > > pBeam->SetBrightness( 255 ); > > > pBeam->SetColor( 255, 145+random->RandomInt( -16, 16 ), 0 ); > > > pBeam->RelinkBeam(); > > > pBeam->LiveForTime( 0.1f ); > > > > > > //Draw electric bolts along shaft > > > for ( int i = 0; i < 3; i++ ) > > > { > > > pBeam = CBeam::BeamCreate( GAUSS_BEAM_SPRITE, (width/2.0f) + i ); > > > > > > if ( useMuzzle ) > > > { > > > pBeam->PointEntInit( endPos, m_hViewModel ); > > > pBeam->SetEndAttachment( 1 ); > > > } > > > else > > > { > > > pBeam->SetStartPos( startPos ); > > > pBeam->SetEndPos( endPos ); > > > } > > > > > > pBeam->SetBrightness( random->RandomInt( 64, 255 ) ); > > > pBeam->SetColor( 255, 255, 150+random->RandomInt( 0, 64 ) ); > > > pBeam->RelinkBeam(); > > > pBeam->LiveForTime( 0.1f ); > > > pBeam->SetNoise( 1.6f * i ); > > > pBeam->SetEndWidth( 0.1f ); > > > } > > > } > > > > > > _______________________________________________ > > > To unsubscribe, edit your list preferences, or view the list archives, > > > please visit: > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > -- > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders