-1

I was wondering about how to detect if there's a wall between two players. Does a command to do it exists or any code snippet?

Lario
  • 5
  • 3
  • 1
    Hello Welcome to StackOverflow. It seems a little early to ask this question, for a question like this you want to be able to show some effort, things like attempts to solve the problem or documents you have looked at for the given API. As it stands now, to me your effort appears to be you identified the problem you wanted to solve and then posted this question. – Nifim Jan 21 '21 at 15:45
  • I think the keyword you need is "trace" (as in ray tracing) – user253751 Jan 21 '21 at 15:46

1 Answers1

0

I'm sure there are multiple ways to achieve this.

One is to use ents.FindAlongRay

table ents.FindAlongRay( Vector start, Vector end, Vector mins = nil, Vector maxs = nil )

Returns a table of all entities along the ray. The ray does not stop on collisions, meaning it will go through walls/entities.

So if you know where both players are you can check wether the wall of interest is among the entities found along that ray between both players.

Piglet
  • 27,501
  • 3
  • 20
  • 43