Is there a simple way to set a entitys position on the map without it going out of bounds? I've tried things like [CODE]ent:SetPos(math.rand(-5000, 5000), 0, math.rand(-5000, 5000))[/CODE] but the Y position always seems to be random for some reason and most of the time it is out of the map. Thanks.
Same position in terms of Vectors differs for every map.
Not all maps are built the same and not all maps start from the center of the grid.
Anyways - you can make a loop to generate a random position, then place ent there, check if it's in world via IsInWorld() and if it's on the ground via IsOnGround() - repeat until both checks return true.
[QUOTE=Netheous;49383027]Same position in terms of Vectors differs for every map.
Not all maps are built the same and not all maps start from the center of the grid.
Anyways - you can make a loop to generate a random position, then place ent there, check if it's in world via IsInWorld() and if it's on the ground via IsOnGround() - repeat until both checks return true.[/QUOTE]
Thank you very much!
Sorry, you need to Log In to post a reply to this thread.