Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class OriginMovement : MonoBehaviour
- {
- public GameObject world;
- private float chunkSize = 5000;
- // Update is called once per frame
- void Update ()
- {
- float distanceToOrigin = Vector3.Distance (this.transform.position, Vector3.zero);
- Vector3 worldDirection = this.transform.position - Vector3.zero;
- if (distanceToOrigin >= chunkSize) {
- this.transform.position = Vector3.zero;
- world.transform.position += worldDirection * -1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement