0
我不明白爲什麼這個腳本會導致對象跳到目的地而不是順利地移動到它?Unity 2D c#目標出現在目標不是「Lerping」
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));
}
}
}
任何幫助非常感謝,
感謝,
感謝斯科特,這仍然導致它出現在目的地不移動那裏雖然? – Uberzen1 2014-09-04 21:42:37
你介意更新代碼嗎?會更容易弄清楚 – Scott 2014-09-05 01:22:48