一、目的

效果图如下

螺旋运动

 二、代码如下

想要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);
	}
}

 

相关文章:

  • 2021-10-29
  • 2021-09-27
  • 2021-07-12
  • 2021-04-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-08-06
  • 2022-02-08
相关资源
相似解决方案