Advertisement
code_gs

Untitled

Apr 5th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. -- Detects if anything is inside the player's collision hull
  2. local player = player_youre_tracing
  3. local pos = player:GetPos()
  4. local mins, maxs
  5.  
  6. if (player:Crouching()) then
  7.     mins, maxs = player:GetHullDuck()
  8. else
  9.     mins, maxs = player:GetHull()
  10. end
  11.  
  12. local tr = util.TraceHull({
  13.     start = pos,
  14.     endpos = pos,
  15.     mask = MASK_PLAYERSOLID,
  16.     collisiongroup = player:GetCollisionGroup(),
  17.     filter = player,
  18.     mins = mins,
  19.     maxs = maxs
  20. })
  21.  
  22. if (tr.Hit) then
  23.     -- Something is inside the player
  24.     -- tr.Entity will provide exactly what
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement