我不明白为什么这个脚本会导致对象跳转到目的地而不是平稳地移动到目的地?
public GameObject Hand;
public GameObject projectile;
void OnCollisionStay2D (Collision2D coll)
{
if (Input.GetKeyDown (KeyCode.E)) {
if (coll.gameObject.tag == "Pickup") {
if (Hand.transform.childCount < 1) {
coll.gameObject.transform.position = Hand.transform.position;
coll.gameObject.transform.parent = Hand.transform;
projectile = coll.gameObject;
//coll.gameObject.name = "Projectile";
}
}
}
}
void Update ()
{
if (Input.GetMouseButtonDown (1)) {
if (Hand.transform.childCount == 1) {
projectile.transform.rotation = Hand.transform.rotation;
projectile.gameObject.transform.parent = null;
float shotDistance = 3;
float time = 3;
projectile.transform.Translate(Vector3.Lerp (Hand.transform.position,Vector3.up * shotDistance,time));
}
}
}
非常感谢任何帮助,
谢谢,