Download

Problem defining maximum distance between players

Hello! I managed to do it… more or less. I did a camera that find the medium location of all possible players and move camera there. To keep players in screen I did a “square” that follow camera. The idea is that when a player touch one of those “walls” can’t move more far away. And it work.

So, just let me explain the problem.

Player 1 is pushing left wall to left. Player 2 is stopped. Player 1 can’t move to left because Player2 is at the limit in right wall. This is OK
Player 1 is stopped. Player 2 is pushing right wall to right. Player 2 can’t move to right because Player 1 is at limit in the left wall. This is OK

Player 1 is pushing left wall to left. Player 2 is pushin right wall to right. In this case walls should to forbid players move in the direction that they are trying move. But instead a player can move pushing all the wall and the other player.

1c729e895e33657ab747943dd80c0edf4434ec12.png

Which player is the winner in this “rope competition”? Depend the position in the walls in the blueprint. If I move a bit to right a wall then is one. If move to left, then is the other.

Here is the Blueprint that move the Camera and the “Wall”:

cbe8599881e09cb271c3d5e2bf154a0000d5dd92.png

94fadcb7c6f2ad970c075b117c10e1b771afe5f7.png

Of course, and like always, I accept tip and sugerences. Maybe there is a really better way to do all this and I am complicating it so much or whatever.

Thanks so much!

Hello again. I finally find the problem: It is because the walls weren’t a perfect structure (I mean +x must be exact to -x ie). With a perfect structure it works, but it make the playable zone small, or atleast not exactly what I wanted.

After that I tryed check the distance and, with booleans, stop their movements when is too far away and let them back to correct their position:

b86c1b9946c073643063a3827da391e5.png

It worked more or less good, but with diagonals it crash alot.

In resume… I need that players don’t go so far away between them, but don’t know how to do it. Any advice are welcome. Thanks!