* Title: ””
* Function:
* - 太阳自转
* - 地球自转、公转
* - 月球自转、公转
* Used By: Main Camera
* Author: V.
* Date: 2016.12.
* Version: 1.0
* Description(Record):
*
************************/
using UnityEngine;
using System.Collections;
public class SunEarthMoon : MonoBehaviour
{
public Transform TrSun; //定义太阳的transform
//public GameObject GoSun;
public Transform TrEarth; //定义地球的transform
public Transform TrMoon; //定义月球的transform
// public GameObject GO;
// public Camera MyCamera;
public float FlRotaSpeedSelf; //自转速度
public float FlRotaSpeedCommEarth; //地球公转速度
public float FlRotaSpeedCommMoon; //月球公转速度
void Update ()
{
//太阳自转
//this.gameObject.transform.Rotate ();
//transform.Rotate();
TrSun.Rotate (Vector3.up * FlRotaSpeedSelf);
//GoSun.transform.Rotate ();
//地球自转
TrEarth.Rotate (Vector3.up * FlRotaSpeedSelf);
//地球公转
TrEarth.RotateAround(
TrSun.position, Vector3.up, FlRotaSpeedCommEarth);
//月球自转
TrMoon.Rotate(Vector3.up * FlRotaSpeedSelf);
//月球公转
TrMoon.RotateAround(
TrEarth.position, Vector3.up, FlRotaSpeedCommMoon);
}//end_Update
}
素材连接地址 : 链接:http://pan.baidu.com/s/1dFnGWd7 密码:05t1