我有一个代码可以清楚地在我选择的A点和B点之间工作。现在,我想编辑此代码,无论我单击何处,多维数据集都可以使用Lerp代码顺利运行。我做不到 这是我的代码:
using System.Collections;
using UnityEngine;
public class LerpTest : MonoBehaviour
{
public float start = 0.0f;
public float end = 5.0f;
public float delay = 1.0f;
public float factor = 0.1f;
public float epsilon = 0.01f;
void Update()
{
if (start != end)
{
start = Mathf.Lerp(start, end, Time.deltaTime * factor);
if (end - start < epsilon)
start = end;
transform.position = new Vector3(start, 0, 0);
}
}
}