Advertisement
Guest User

Untitled

a guest
Jul 6th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. --// This script prevents crashes that happen when objects move to far from the origin.
  2. --// For updates check: http://douglashuck.com
  3. --// Version 1.5
  4.  
  5. local Ent = FindMetaTable("Entity")
  6. local Phys = FindMetaTable("PhysObj")
  7.  
  8. Ent.SetRealPos = Ent.SetRealPos or Ent.SetPos
  9. Phys.SetRealPos = Phys.SetRealPos or Phys.SetPos
  10.  
  11. local clamp = math.Clamp
  12. function Ent.SetPos(ent, pos)
  13. pos.x = clamp(pos.x, -32768, 32768)
  14. pos.y = clamp(pos.y, -32768, 32768)
  15. pos.z = clamp(pos.z, -32768, 32768)
  16. Ent.SetRealPos(ent, pos)
  17. end
  18. function Phys.SetPos(phys, pos)
  19. pos.x = clamp(pos.x, -32768, 32768)
  20. pos.y = clamp(pos.y, -32768, 32768)
  21. pos.z = clamp(pos.z, -32768, 32768)
  22. Phys.SetRealPos(phys, pos)
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement