Guest User

Untitled

a guest
Oct 19th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class PlanetSpace : MonoBehaviour {
  4.  
  5. public WorldCenterer world;
  6. public float scale = 1000000f;
  7. public Camera localCamera;
  8.  
  9. public void FixedUpdate() {
  10. WorldCenterer localWorld = gameObject.GetComponent<WorldCenterer>();
  11.  
  12. if (null == localWorld) {
  13. localCamera.transform.position = world.relativePosition/scale;
  14. } else {
  15. localCamera.transform.position = world.relativePosition/scale - localWorld.relativePosition;
  16. }
  17. localCamera.transform.rotation = world.focalObject.transform.rotation;
  18. }
  19.  
  20. }
Add Comment
Please, Sign In to add comment