一、目的
效果图如下
二、代码如下
想要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);
}
}