Tuoyuan.cs 514 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Tuoyuan : MonoBehaviour
  5. {
  6. public GameObject cubeModel;
  7. private float r = 0.25f;
  8. private float R = 0.5f;
  9. public float angle = 0;
  10. // Use this for initialization
  11. void Update()
  12. {
  13. Vector3 center = cubeModel.transform.position;
  14. float hudu = (angle / 180) * Mathf.PI;
  15. float xx = R * Mathf.Cos(hudu);
  16. float yy = r * Mathf.Sin(hudu);
  17. cubeModel.transform.position = new Vector3(xx,0 , yy);
  18. }
  19. }