【发布时间】:2021-11-01 15:43:25
【问题描述】:
Unity3D,C#
我想知道如何使用半径平滑移动对象,我希望对象从transform.position开始以圆形移动,像这样:sample of what I want to do,并且只使用C#脚本,我能想到的of 正在使用如下变换。
timeCounter += Time.deltaTime * speed;
float x = Mathf.Cos(timeCounter) * width;
float z = Mathf.Sin(timeCounter) * height;
transform.position = new Vector3(x, 0, z);
我试过这个https://forum.unity.com/threads/how-to-make-an-object-move-in-a-circular-motion-at-constant-speed.526107/,但这不是我想要的,我的答案(https://youtu.be/V2A-0yOUNwc)使对象快速向右移动,它使用中间位置作为中心,然后从右侧开始移动,而且我无法控制它会从哪个角度开始。
【问题讨论】:
标签: c# visual-studio unity3d