How to make a safe zone BUT in a light shaft way

Hey everyone! I know the title is a little bit confusing however, What i’m trying to do is make a safe zone not in a circle way like if you leave x y z in the specific radius you will get damaged but rather lets say i want the x y z to be from the lowest point to the highest point of the map and be safe in there not in A sphere looking way but rather in a Light shaft way

I’m horrible at explaining stuff if anyone needs more elaborating i’ll explain more further :sweat_smile:

essentially you want a tube detection box instead of a sphere detection box?

The easiest way is to just make it square, and compare the X and Z values of each position (the player and the centre of the safe zone). You don’t care about Y because Overwatch is a Y-Up system.

The hard way is to use a little more vector math. Use a variable to represent the player’s X,Z position, ignoring the Y component. Then compare the distance between that vector and the safe zone’s X,Z position. This might cost a little more performance as well because you need to be constantly updating the player’s (X,Z) variable using the player’s position. Not sure off the top of my head if there’s a more performance efficient way.

Hello jaakezzz! Thank you so much for your help, yeah i was looking for that Tube looking area but as you said the square was way easier and i had thought of it before but didn’t know how to do it BUT gladfully i figured it out and it works just like how i wanted! So thanks! :slight_smile:

1 Like