[Unity] 让物体像气球一样升高。
我们将向您展示如何创建目标游戏中使用的气球运动。
首先,准备一个以气球模型为子元素的对象。
为对象添加一个 Rigidbody 并添加一个脚本。在本例中,我使用 Target 作为脚本名称。
接下来,预制对象。*可选。


在 Target 脚本的内容中,对象在 FixedUpdate 中向上升起,在 Mathf.PingPong 中左右摆动。

下面是一个基于 WebGL 的实际示例。
在目标游戏中,气球从九个位置随机出现。
– 示例 -.
可能还有其他更好的方法(汗),请参考。m