Check out proto_sniper.cpp on the server. It's the Combine sniper and it uses a CBeam, which appears pretty smooth and fast to me in-game. However that might just be because it's coded to have smooth movement.
DrBob wrote:
OK. I tried your code verbatim, and it made the beam dance in a little ball around my muzzle. I modified it to get the proper angles (which gave me basically the same code as I had before), and I've got the following in my beam update function (which is called by ItemPostFrame in the weapon class, as ItemBusyFrame seems to only be called once during the execution of the whole game): #ifdef CLIENT_DLL if( m_Beam.m_hLinkedToEntity != NULL ) { Vector endPos, shotDir; endPos = m_Beam.m_hLinkedToEntity->Weapon_ShootPosition(); m_Beam.m_hLinkedToEntity->EyeVectors( &shotDir ); trace_t tr; UTIL_TraceLine( endPos, endPos + ( shotDir * MAX_TRACE_LENGTH ), MASK_SHOT, m_Beam.m_hLinkedToEntity, COLLISION_GROUP_NONE, &tr ); endPos = tr.endpos; m_Beam.UpdateEndPosition( endPos ); } #endif // CLIENT_DLL It's just as slow as before. I have a feeling I should be using a CBeam, but I don't know. To be honest, there's no real documentation I could find about the differences between CBeam and BeamInfo_t, and all the different types of beams, etc. :S Alex Thomson wrote:You'll want to link the beam to an entity (the character that fired it, or possibly even the weapon which fired it). Probably the best way to do this is something like: [in your beam class declaration] CHandle<CBaseEntity> m_hLinkedToEntity; [in your beam spawn function] pBeam->hLinkedToEntity = pPlayerWhoFiredMe; [in your beam update function e.g. ItemBusyFrame] if( hLinkedToEntity != NULL ) { my_end_point = hLinkedToEntity->Weapon_ShootPosition(); } So if the beam's linked to an entity, it will update the beam's position every frame. Provided your class is defined on the client and the server, this will update both. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 15 August 2005 10:16 To: [email protected] Subject: [hlcoders] Beams that move with you Right. I'm still working on this beam weapon, and I've just decided that my beam code isn't good enough. :P Currently, I'm setting up a BeamInfo_t structure, and then displaying it using beams->CreateBeamEntPoint( beamInfo ), where "beams" is the statically exposed IViewRenderBeams object. This is fine, until you come to move; the end point of the beam stays anchored to one point. It was late at night when I encountered this, so I just hackhacked it to update the end point of the beam with a freshly calculated vector based on the player's eye angles every frame. My problem is that this is OK for beams that switch off quickly, but for continuous-fire beams (a la Star Trek phaser), it lags. Badly. Is there a beam creation function similar to CreateBeamEntPoint that would take, for example, a start point, and a vector, and make the beam always point in that direction, transparently? Or, have I got it all wrong, and should I be using a CBeam? :S _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ __________________________________________________________________________________________________________________________________________ Information contained in this e-mail is intended for the use of the addressee only, and is confidential and may be the subject of Legal Professional Privilege. Any dissemination, distribution, copying or use of this communication without prior permission of the addressee is strictly prohibited.The views of the author may not necessarily constitute the views of Kuju Entertainment Ltd. Nothing in this email shall bind Kuju Entertainment Ltd in any contract or obligation. The contents of an attachment to this e-mail may contain software viruses which could damage your own computer system. While Kuju Entertainment has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening the attachment. __________________________________________________________________________________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email _________________________________________________________________________________________________________________________________________ _______________________________________________ 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

