|
var FirePoint:Transform;
var Bullet:Rigidbody;
var BoomFire:Transform;
function Start () {
}
function Update () {
if(Input.GetKeyDown(KeyCode.Space))
{
var clone:Rigidbody;
var BoomFireClone:GameObject;
clone = Instantiate(Bullet,FirePoint.position,FirePoint.rotation);
clone.velocity = this.transform.TransformDirection(Vector3.forward*500);
Instantiate(BoomFire,FirePoint.position,FirePoint.rotation);
//Destroy(BoomFireClone);
}
}
坦克身上绑定该脚本,clone = Instantiate(Bullet,FirePoint.position,FirePoint.rotation);是产生炮弹,碰撞后调用destory可以正常删除。
但Instantiate(BoomFire,FirePoint.position,FirePoint.rotation);产生炮口的爆炸效果,不知道该如何删除了,求高人指点 |
|