So I'm working on yet another script for my server and I'm trying to make a ghosting script that only ghosts props if they're inside eachother.
This is what I have so far:
local function Ghosting()
for k, v in pairs(ents.FindByClass("prop_physics")) do
local radi = ents.FindInSphere(v:OBBCenter(), v:BoundingRadius())
end
end
hook.Add("Think", "dghrtafsdadfs", Ghosting)
Any help appreciated!
What I think you want to do is loop through the table of entities that are inside of the entity (since ents.FindInSphere returns a table value)
So
for key, ent in pairs(radi) do
print(key)
PrintTable(ent)
end
This should get you further.
Good idea
util.TraceHull ??
What's hapenning? Getting any errors?
Maybe
I'm getting this error when i call it
Running script ghosting.lua...
] testcommand
1
[ERROR] lua/includes/extensions/table.lua:679: bad argument #1 to 'pairs' (table expected, got userdata)
1. pairs - [C]:-1
2. GetKeys - lua/includes/extensions/table.lua:679
3. PrintTable - lua/includes/util.lua:62
4. unknown - lua/ghosting.lua:7
5. unknown - lua/includes/modules/concommand.lua:54
Also sorry for the extremely late reply I got super busy
Ah yes, an entity isn't a table, my bad.
Try printing out ent:GetPos()
Sorry, you need to Log In to post a reply to this thread.