【Uinty3D】2D飞机的基础——子弹速度及销毁

2D物体速度

定义物体刚体

pubilc Rigidbody2D rig;

定义物体速度

public float ballSpeed = 15f;

在Start函数中

  获取刚体

  rig = GetComponrnt<Rigidbody2D>();

在Updata函数中

  赋予物体速度

  rig .velocity = Vector2.up * ballSpeed;

销毁物体

  在Start函数中

  三秒后销毁

  Destory(this.gameObject,3);

posted @ 2018-12-11 15:17  Whiteying  阅读(232)  评论(0编辑  收藏  举报