document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class OriginMovement : MonoBehaviour
  5. {
  6.  
  7.         public GameObject world;
  8.         private float chunkSize = 5000;
  9.  
  10.         // Update is called once per frame
  11.         void Update ()
  12.         {
  13.                 float distanceToOrigin = Vector3.Distance (this.transform.position, Vector3.zero);
  14.                 Vector3 worldDirection = this.transform.position - Vector3.zero;
  15.  
  16.                 if (distanceToOrigin >= chunkSize) {
  17.                         this.transform.position = Vector3.zero;
  18.                         world.transform.position += worldDirection * -1;
  19.                 }
  20.  
  21.                
  22.                
  23.  
  24.         }
  25. }
');