Create a beam effect which start from a player and ends where he looks

How can I do that, my beam starts from the event player but I can’t have it to end where the event player is looking, I’ve tried all sorts of tweaks but obviously there’s something I’m not seeing…
Thank you !

The position where the player looks at is at

eye position(event player) + facing direction of(event player) * "distance"

“Distance” is the number to manipulate the length of the beam.
If you want the beam to stop at walls/other player you can use “ray cast hit”:

ray cast hit position(eye position(event player), eye position(event player) + facing direction of(event player) * "distance", ...)

Thank you, and another question, is there a way you can add a “if the beam touches someone, then …” ?

Instead of “ray cast hit position” you use “ray cast hit player(the same stuff like in the post above) != null” as condition for the rule.

Where do I need to put this ? h ttps://imgur.com/a/bxCl2kq

Shanalotte, do not you see it is just a wasting of your time? ArfusIsBae has no an idea what (s)he wants and what is workshop. Instead of trying to make something easier or asking for a whole solution, (s)he asks for unknown level of code… it is endless and nonsense path…

that’s rude dude …

1 Like

that’s truth dude… learn basic of workshop before to do something with rays…

That’s because of people like you that OW has one of the worst community, if you were a little altruistic, you’d help me, I’m trying to have fun and do some new things on Overwatch and next time, either you post something relevant, or you don’t post at all.

3 Likes

And you call me rude dude?? Useless…

Dude, you’re basically saying “stop trying things like that, learn the basics” and you tell the guy, that I thank, who helped me, that he’s loosing his time, I’m a beginner and I’m just trying to have fun and you come and say “yo don’t help him”, so yeah, either you help me or you’re friendly in your answer, or you don’t answer at all.

3 Likes

Yes, this way it is just a wasting of a time of someone who can help other forum-mates. What if and what if and what if… wth… dude, say exactly what you want and what you did for it so other one can say what to do to get there… do not be like a blind one…

He gave me this

But I don’t know where to put it with OW’s HUD, that’s all, that’s why I posted the link to a picture, I just want to create a beam, that starts from the event player and goes where the event player is looking, that’s all and I’m sure it’s not “nonsense”

1 Like

This forum already contains tons of same questions and answers… Even simple Youtube search by “ray cast overwatch workshop” gives you a lot of explanations… Try to learn basic, do not start with something you cannot handle yet…

The “ray cast hit position(…)” defines the end position of the beam effect, so you put it in the “end position” value in the “create beam effect” action.

2 Likes

Here is the code, You can directly copy into the workshop.

I make 2 different way Inside Rule 1, They all have the same visual result but the first one cost more server power(much more).

I’m not sure what you want of “if the beam touches someone” so I just make another rule that when the beam touches(visually) someone it will show who.

rule("Rule 1")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Has Spawned(Event Player) == True;
	}

	actions
	{
		"10 is for distance"
		Create Beam Effect(All Players(All Teams), Bad Beam, Event Player, Ray Cast Hit Player(Eye Position(Event Player), Eye Position(
			Event Player) + Facing Direction Of(Event Player) * 10, All Players(All Teams), Event Player, True)
			!= Null ? Ray Cast Hit Position(Eye Position(Event Player), Eye Position(Event Player) + Facing Direction Of(Event Player)
			* 10, All Players(All Teams), Event Player, True) + Facing Direction Of(Event Player) : Ray Cast Hit Position(Eye Position(
			Event Player), Eye Position(Event Player) + Facing Direction Of(Event Player) * 10, All Players(All Teams), Event Player,
			True), White, Visible To Position and Radius);
		"second way"
		disabled Create Beam Effect(All Players(All Teams), Good Beam, Eye Position(Event Player), Ray Cast Hit Position(Eye Position(Event Player),
			Eye Position(Event Player) + Facing Direction Of(Event Player) * 10, All Players(All Teams), Event Player, True), White,
			Visible To Position and Radius);
	}
}

rule("if the beam touches someone")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Ray Cast Hit Player(Eye Position(Event Player), Eye Position(Event Player) + Facing Direction Of(Event Player) * 10, All Players(
			All Teams), Event Player, True) == True;
	}

	actions
	{
		Small Message(All Players(All Teams), Ray Cast Hit Player(Eye Position(Event Player), Eye Position(Event Player)
			+ Facing Direction Of(Event Player) * 10, All Players(All Teams), Event Player, True));
	}
}

I think this is ok to ask this kind of question, the name Ray Cast is hard to associate with the position you look… if you don’t know what is that function does(Not sure other people but that’s me when I try workshop in the first time).
Well…It’s not straight like “Damage” or “Set Status”.

But yeah, perhaps you should search this forum to see if there is something similar, Just to prevent the forum has too many same posts of contents, This will cause hard to search for something is similar but different.

Never start a beam from " Eye Position(Event Player) " because this flashing is not nice for eyes. Better to start higher or lower eye level. Just a tip…

Thank you for the tip.
I barely touch the beam stuff.

Rany is annoying and close minded in all his 520 posts… sheesh glad you could get help from Shanalotte they seem very nice in every post I’ve Read

2 Likes

+1 Shanalotte has been positive and helpful every time I see their comments

2 Likes