public class Test : MonoBehaviour {
// Use this for initialization
public float speed = 10f;
public float t =1f;
public float a =10f;
public float b =1f;
public float x;
public float y;
public float z;
void Start () {
}
// Update is called once per frame
void Update () {
t += Time.deltaTime * .01f *speed;
x = a * Mathf.Cos (t);
y = a * Mathf.Sin (t);
z = b * t;
transform.position = new Vector3 (x,y,z);
}
}
可以实现螺旋线效果,如果想看最终效果可以放在一个空物体上,在空物体上面添加一个组件
TrailRenderer即可看到最终效果
l螺旋线方程
最新推荐文章于 2022-10-25 10:55:28 发布