How do i make an object (terrain) have borders and when it touches a border, then it goes to the opposite part of the world?
If you want to keep the object inside some rectangle, a simple way is to compare transform.position to the limits, and revert the direction of movement when some limit is found - but only the related axis: if the object touches the min x limit, for instance, revert direction in x only. The actual implementation will depend on the way you move the object, but the basic idea is:
var xMin: float = 10; var xMax: float = 190; var zMin: float = 10; var zMax: float = 190; var dirX: float = 1; var dirZ: float = 1; var speed: float = 4.0; function Update(){ var pos = transform.position; if (pos.x < xMin || pos.x > xMax) dirX = -dirX; if (pos.z < zMin || pos.z > zMax) dirZ = -dirZ; // move the character according to dirX and dirZ: transform.Translate(speed * Time.deltaTime * dirX, 0, speed * Time.deltaTime * dirZ); }