如何让物体围绕圆心角与圆周角的关系做圆周运动圆心角与圆周角的关系为(x,y)有一个

用Unity开发游戏中,经常会有搜寻的功能,这时候我们需要一个放大镜的图标在那圆周运动。写了相关脚本直接挂载在要圆周运动的物体上即可:
using UnityE
using System.C
public class RoundAction : MonoBehaviour
public float _radius_
public float _angle_
private float temp_
private Vector3 _pos_
public Vector3 _center_
public bool _round_its_
// Use this for initialization
void Start()
if (_round_its_center)
_center_pos = transform.localP
// Update is called once per frame
void Update()
temp_angle += _angle_speed * Time.deltaT //
_pos_new.x = _center_pos.x + Mathf.Cos(temp_angle) * _radius_
_pos_new.y = _center_pos.y + Mathf.Sin(temp_angle) * _radius_
_pos_new.z = transform.localPosition.z;
transform.localPosition = _pos_
阅读(...) 评论()

我要回帖

更多关于 物体做圆周运动的条件 的文章

 

随机推荐