I made a function to find a random point on the ground, but if the map has a skybox camera room, then it sometimes picks up a point in there. I need a way to differentiate the normal areas from the skybox. Here’s my code, thank you very much.

Vector:IsEmpty()

[lua]

function _Vec:IsEmpty()

local Contents = util.PointContents(self)

print(Contents)

if Contents == 0 then return true end

return false

end

[/lua]

Getting the random point:

[lua]

function GetRandomPoint()

local min, max = -16380, 16380

local Point

local function NewPoint()

local x, y, z = math.random(min,max), math.random(min,max), math.random(min,max)

Point = Vector(x, y, z)

if not Point:IsEmpty() then

NewPoint()

end

end

```
NewPoint()
while Point:IsEmpty() do
return Point
end
```

end

function GetRandomGroundPoint()

local Point = GetRandomPoint()

local uptrace_data = {}

uptrace_data.start = Point

uptrace_data.endpos = Point + Vector(0,0,16380)

uptrace_data.mask = CONTENTS_SOLID

local uptrace = util.TraceLine(uptrace_data)

Point = uptrace.HitPos

local downtrace_data = {}

downtrace_data.start = Point - Vector(0,0,10)

downtrace_data.endpos = Point - Vector(0,0,16380)

local downtrace = util.TraceLine(downtrace_data)

Point = downtrace.HitPos + (downtrace.HitNormal * 25)

```
return Point
```

end

[/lua]