Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// This script prevents crashes that happen when objects move to far from the origin.
- --// For updates check: http://douglashuck.com
- --// Version 1.5
- local Ent = FindMetaTable("Entity")
- local Phys = FindMetaTable("PhysObj")
- Ent.SetRealPos = Ent.SetRealPos or Ent.SetPos
- Phys.SetRealPos = Phys.SetRealPos or Phys.SetPos
- local clamp = math.Clamp
- function Ent.SetPos(ent, pos)
- pos.x = clamp(pos.x, -32768, 32768)
- pos.y = clamp(pos.y, -32768, 32768)
- pos.z = clamp(pos.z, -32768, 32768)
- Ent.SetRealPos(ent, pos)
- end
- function Phys.SetPos(phys, pos)
- pos.x = clamp(pos.x, -32768, 32768)
- pos.y = clamp(pos.y, -32768, 32768)
- pos.z = clamp(pos.z, -32768, 32768)
- Phys.SetRealPos(phys, pos)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement