Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class finalna : MonoBehaviour {
  5.     float xz;
  6.     float yz;
  7.  
  8.     float xm;
  9.     float ym;
  10.     float zm;
  11.  
  12.     public float az = 15;
  13.     public float am = 5;
  14.  
  15.     float vz;
  16.     float vm = 0;
  17.  
  18.     public float i = 5;
  19.     public float omega;
  20.  
  21.     public float n = (float)0.1;
  22.     float nom;
  23.     public float odnosnomega = 18;
  24.  
  25.     // Use this for initialization
  26.     void Start () {
  27.    
  28.     }
  29.    
  30.     // Update is called once per frame
  31.     void Update () {
  32.         if (vm == 359.9) vm = 0;
  33.         else vm = vm + (float)0.1;
  34.         vz = n * vm;
  35.  
  36.         nom = odnosnomega * n;
  37.         omega = nom * vz;
  38.  
  39.         xz = az * Mathf.Cos (vz);
  40.         yz = az * Mathf.Sin (vz);
  41.  
  42.         xm = am * (Mathf.Cos (omega) * Mathf.Cos (vm) - Mathf.Sin (omega) * Mathf.Cos (i) * Mathf.Sin (vm));
  43.         ym = am * (Mathf.Sin (omega) * Mathf.Cos (vm) - Mathf.Cos (omega) * Mathf.Cos (i) * Mathf.Sin (vm));
  44.         zm = am * Mathf.Sin (i) * Mathf.Sin (vm);
  45.  
  46.         GameObject.Find("Zemlja").transform.position = new Vector3(xz, yz, 0);
  47.  
  48.         GameObject.Find("Mesec").transform.position = new Vector3(xm, ym, zm);
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement