Unity 2D移动和旋转问题

问题描述 投票:1回答:1

我正在努力将直升机添加到我的2D游戏中,我还需要它以圆周运动同时在x轴上移动。在下面,您可以找到我使用的使用数学圆方程的代码。

angle += speed * Time.deltaTime; //if you want to switch direction, use -= instead of +=
float x = startPoint.x + Mathf.Cos(angle) * radius;
float y = startPoint.y + Mathf.Sin(angle) * radius;
transform.position = new Vector2(x + 2, y);

直升机可以正确旋转,但是我不知道如何使它沿着x轴移动。它应如何工作的概念图如下:enter image description here

unity3d equation motion euler-angles
1个回答
0
投票

1)创建一个空的游戏对象

2)将盒子作为空白游戏对象的父项>

3)围绕空游戏对象旋转方框

4)将空游戏对象移到侧面

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.