How do I make a barrier that players cannot trespass?

Just like in Deathmatch where there are barriers that players can’t go through (or in enemy spawns), I would like to make a barrier to prevent players passing through it in the first 30 seconds of the round. I can be visible or not (would prefer it visible), I just want to restrict access to a zone for a while.

The simple way would be to use sphere effects blocking player movement. You don’t even need the actual sphere effects, but they are good for visualization:

  • Create an array containing all the center positions of the blocking spheres (e.g. “spherePosition”)
  • Create an array containing all the radiuses of the blocking spheres (e.g. “sphereRadius”)
  • Use this rule:
rule - ongoing each player

condition:
- has spawned(event player) == true
- is true for any(global variable(spherePosition), compare(distance between(event player, current array element), <=, value in array(global variable(sphereRadius), index of array value(global variable(spherePosition), current array element)))) == true

action:
- set player variable(event player, closestSphere, first of(sorted array(global variable(spherePositions), distance between(event player, current array element))))
- apply impulse(event player, direction towards(player variable(event player, closestSphere), event player), 20, to world, cancel contrary motion)

As you can see, the “barriers” are ball-shaped, wich works well with the most smaller entrances. It can get a bit messy with blocking bigger entrances this way.

There are actually multiple ways to make straight barriers in the shape of a wall. But they are a lot more complicated, while the solution using spheres is very simple.

1 Like

Probably going to do it with small entrances. I wanted to do a barrier that went through all map and i came up with a non-visible barrier that uses the x, y or z component and aplies a impulse.

Currently there is no an option to create a solid object (visible or not), even no an option to create a square, only sphere. For example, if your “block” object is too small then heroes like Tracer can jump over it and keep running same direction. And for sure, you will need to check whole Y coordinate to prevent passing heroes like Pharah by flying.


More info about me and my game mods you can find here.

There is. Here: How to make a straight wall we discussed 2 ways to create a straight wall.

Will it block also Sombra’s translocator for example?


More info about me and my game mods you can find here.

No, of course not. The solution I suggested will allow sombra to teleport through it. I think, Link2396’s solution will push her back after she teleported towards it though.

OPs point wasn’t solid objects but restricting the accessability of certain areas.

Understood :+1:


More info about me and my game mods you can find here.