【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);

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务