Advertisement
blainebrown

Untitled

Dec 19th, 2011
23
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. using System.Collections;
  3.  
  4. public class Sphere : MonoBehaviour {
  5.  
  6. public GameObject cube;
  7. public Vector3 spherePos;
  8. public Vector3 cubePos;
  9.  
  10. void Awake ()
  11. {
  12. }
  13.  
  14. // Use this for initialization
  15. void Start ()
  16. {
  17. spherePos = this.transform.position;
  18. cubePos = GetCubePos();
  19. }
  20.  
  21. // Update is called once per frame
  22. void Update ()
  23. {
  24. this.transform.position = Vector3.MoveTowards(this.transform.position, cubePos, 1);
  25. }
  26.  
  27. Vector3 GetCubePos()
  28. {
  29. cube = GameObject.Find("Cube");
  30. return cube.transform.position;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement