我想将rigidbody2d(Ship)的实例化从一个点移动到另一个点
Shippos是我的观点a
Targetpos是我的观点b。
他们在检查员中分配,
通过鼠标单击对象触发实例化,
我的问题是我无法弄清楚要使用的正确功能,或者在哪里放置它
能够移动我的实例,或者如何控制运动的速度。
public class Attack : MonoBehaviour {
public Transform ShipPos;
public Transform Targetpos;
public Timer temp;
public Rigidbody2D ship;
public float speed = 4;
public float step;
void start(){
}
// Update is called once per frame
void Update () {
}
void OnMouseDown(){
step = speed * Time.deltaTime;
temp.timeleft /= 2;
for (int i = 0; i < temp.timeleft; i++) {
Rigidbody2D shipinstance;
shipinstance = Instantiate (ship, ShipPos.position, ShipPos.rotation) as Rigidbody2D;
}
}
}