using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemScript : MonoBehaviour
{
//转动速度
public float speed = 1;
//转动的角度
public float progress = 0;
//中心点
public Transform center;
//半径
public float radius = 3;
void Update() {
progress += Time.deltaTime * speed;
if (progress>=360)
{
progress =0;
}
float x1 = center.position.x + radius * Mathf.Cos(progress);
float y1 = center.position.y + radius * Mathf.Sin(progress);
this.transform.position = new Vector2(x1, y1);
}
}
05-09
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交