Creating beams with entity endpoints
This is not obvious at all, so here's what you do:
Create an env_beam and fill out your basic parameters. To hook it to entities you need to: set SendProp "m_hAttachEntity"[0] to the source entity (the beam itself, or another entity) set SendProp "m_hAttachEntity"[1] to the target entity ie: Code:
SetEntPropEnt( beam, Prop_Send, "m_hAttachEntity", EntIndexToEntRef(tar), 1 );set SendProp "m_nNumBeamEnts" to 2 set SendProp "m_nBeamType" to 2 // the magic is here, this is "BEAM_ENTS" which tells it to use the entity endpoint mode, this is NOT set automatically unlike creating a beam in hammer Full test snippet: Code:
#define MODEL2 "sprites/laserbeam.vmt" |
Re: Creating beams with entity endpoints
This is awesome! Thanks for sharing.
I'd use the enum instead of hardcoding 2. PHP Code:
|
Re: Creating beams with entity endpoints
very interesting, will probably use it!
|
Re: Creating beams with entity endpoints
I release this is rather old but has anyone successfully created a beam that uses the ring flags per the wiki? It says there that it doesn't seem to work, but I see this post: https://forums.alliedmods.net/showthread.php?t=221153, which describes using a ring. However, even when I do exactly the code as per that post I get a straight line.
|
Re: Creating beams with entity endpoints
I have used info targets with env_beams int the past. The touch hooks don't work right unless you toggle the beam off/on after moving the endpoints iirc, which is quite annoying. Other than that, it works OK.
I think lduke's tripmines works off of this same idea. |
Re: Creating beams with entity endpoints
I can create a standard beam.
I shifted it to info_targets and parented one to forward and the other lfoot. However, it still just draws a line, even with spawnflags set to 8. I also tried setting beamflags. I read that they need to be brush entities for the ring to work here: https://developer.valvesoftware.com/wiki/Talk:Env_beam But I am not entirely sure how to make brush entities with SM. I did some searching and found a tutorial but its a bit beyond what I have the time for today. I will try more later. |
| All times are GMT -4. The time now is 23:21. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.