- 创建游戏物体:编写脚本,将游戏物体放置在抛物线上,让游戏物体沿抛物线移动。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParabolaMovement : MonoBehaviour
{
public GameObject startPoint;
public GameObject endPoint;
public float speed;
private float t;
private bool moving;
void Update()
{
if (moving)
{
t += Time.deltaTime * speed;
if (t >= 1f)
{
t = 1f;
moving = false;
}
Move();
}
}
public void<