博主没事写了一个很简单的Doem就几句代码。
就是地球围绕太阳转.
首先创建两个球体,分别设置相应的大小,取名为Sun,Earth。
然后创建一个C#脚本编写代码.
using UnityEngine;
using System.Collections;
public class EarthCtrl : MonoBehaviour {
//声明游戏对象
private GameObject m_GOSun;
private GameObject m_GOEarth;
// Use this for initialization
void Start () {
//获取对象
m_GOSun=GameObject.Find("Sun");
m_GOEarth=GameObject.Find("Earth");
}
// Update is called once per frame
void Update () {
/*
* public