一、目的
效果圖如下
二、代碼如下
想要Z軸方向也可以動手加上去
using UnityEngine;
using System.Collections;
public class Spiral : MonoBehaviour
{
public Transform target;
public float degree;
public float xFactor,yFactor;
void FixedUpdate ()
{
transform.Translate(Time.deltaTime*xFactor,Time.deltaTime*yFactor, 0);
transform.RotateAround(target.position,Vector3.up,degree*Time.deltaTime);
}
}