A laser beam to follow a game element

I was wondering if it is possible to have a laser beam follow a piece of a game. This is for the fortwars game mode. To be more specific, if the ball (rollermine) falls into the water, I want a laser beam to “turn on” pointing straight up and follow it through the water.
The reason is because there is no a single water texture which has a decent viewing distance and with the fortwars game mode people can just sit in the water with the ball and never be found.

I have tried a few things but none of them have been successful. I was thinking just having a trigger above the water which turns on and off the laser and parent the laser to the ball. But what is the ball called and what will the trigger actually be triggered on? I need some sort of name.

Place a trigger_multiple in the water. Then do
OnTouching|<env_beam name>|Enable
OnEndTouch|<env_beam name>|Disable

Please look at the info for trigger_multiple here;

Thanks, that helped but there are still some things I’m not sure about.
I made it work for a prop_physics named “test” that I included in the map.

I made the following:
env_beam called “beam”
2 filter_activator_name with 2 outputs. Filtered for anything named test.

  • OnPass | beam | TurnOn
  • OnPass | beam | TurnOff
    trigger_multiple with 2 outputs
  • onStartTouch | filter1 | TestActivator
  • onEndTouch | filter2 | TestActivator

Then I tried to filter for in-game objects so I tried filtering for a prop. I tried helicopter_bomb01.mdl and that did nothing. Really I was just testing to see if I could use something that wasn’t part of the map since I want the beam to follow the ball which is a part of the gamemode not the map. So how would I follow something that isn’t initially part of the map?

Any ideas?

Can I just find out what the name of the ball is from the developer and use that or will the map not recognize that?

You could probably set the end target to !activator with the trigger_multiple

Well I’m bringing this back because I was finally able to test the map and the beam did not work.

The problem is the beam itself. If I have it where the beam start entity is the beam itself then it works fine even with the filter being set to filter for the game entity ‘ball’. Once I make the beams start entity ‘ball’ it doesn’t work.

I dont understand why the filter would work but the beam wouldn’t. I have also tried parenting the beam to the ball with no luck.

EDIT: Well I kind of got the beam to follow the ball but it is about 320 units off the ball. I set the parent of the beam to the ball once trigger activates. I just can’t figure out why the beam is 320 units off. Is it possible that the ball’s origin is off? It is using the roller.mdl from gmod and in hammer the origin is correct.

You should make the end target to !activator and have the start target to where the beam is comming from.

Ah, that’s what you meant by your previous post. Well since I didn’t know what !activator was I looked it up and that seems like it’d be my best bet but it doesnt work.

Here’s what Valve Says:
!activator - The entity that began the current I/O chain. If a player walks into a trigger that fires a logic_relay, the player is the !activator of the relay’s output(s).

So it should work as the ball starts the I/O chain but it doesnt.

My chain goes like this. Trigger_multiple(triggers by physics objects on touch) -> Filter_activator_name (filters for ball) -> beam (start entity is beam end is !activator)
Quite confused.

Thanks btw for all your help.

You’re welcome. :smile: Glad I could help.

Well I’m just going to start this post over instead of editing it over and over. After much testing I’ve verified that EVERY object that I parent the beam to is about 320 units off from the actual beam not just the ball. So now, just need to figure out why parenting the beam to an object screws it up.

ignore (old post)
It still isn’t working though.
Heh, I was just thanking you in my last post because I didn’t previously.

I’m going to test a few more things to see if I can figure out the problem. Do you need any more info to figure this out?

Do I have to put anything in for the filter name?

Edit: It seems as if the starting/ending entity isn’t a part of the map then the beam won’t work.

Edit2: I made the ending entity a func_brush. Then I set the parent of the brush to !activator and the beam moves but it is still about 320 units off.
Could this be something with the game mode itself?

Is the only entity that is going to make that beam go up, is the ball?

Yes.
I’ve made the beam turn on and off with the ball, I just can’t make it track the ball.
The only thing I can think of right now is to use SetParentAttachment and teleport a func_brush to the ball when the parent is made.

Just set the end target to the ball.

It doesnt work. It seems that the beam only works if the start and end target are a part of the map.

Also I believe the beam isn’t following the ball with parent because parent maintains the original offset. That is why I tried SetParentAttachment but that didn’t work either.

[editline]03:56AM[/editline]

Ok well I figured out a way to do it and since I hate it when I find a thread asking the same question I want answered and the person comes back saying “I figured it out” but tells us what they did, I will say what I did.

First off know this:

  • With an env_beam the start AND ending entities must be a part of the map or the beam will never show up.
  • You can parent the beam to a game element but remember the offset.

So what I did to finally make it work. (If you want to know what I did before this just read the above posts).
Since I had to parent either the beams starting entity or the ending entity to the ball but make sure that either of those entities was in the same position as the ball I had to make a trigger.
So I made a trigger that was set off only by the ball so when the ball fell through it the trigger would set the parent of a func_brush entity I made for the ending entity to the ball. The func_brush has to be in the exact spot where the game realizes that the ball fell through the trigger or else there will still be an offset.

[editline]03:56AM[/editline]
and here’s the final “product”
http://www.wegame.com/watch/bal--water--laser/