using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Sun_moon : MonoBehaviour {
// Use this for initialization
Transform cy;
Transform ce;
void Start () {
//查找被环绕物体
cy = GameObject.Find("Sun").transform;
ce= GameObject.Find("moon").transform;
}
// Update is called once per frame
void Update () {
//脚本依附的物体围绕cy的Y轴旋转
transform.RotateAround(cy.position, Vector3.up, 50 * Time.deltaTime);
ce.RotateAround(transform.position, Vector3.up, 500 * Time.deltaTime);
//被环绕物体自传
cy.Rotate(0, 300 * Time.deltaTime, 0);
}
}