首先,这里子弹要模拟的相似的话,用2D刚体比较好,会有重力,自由落体运动. using UnityEngine; using System.Collections; public class gun : MonoBehaviour { public Rigidbody2D rocket; public float speed; // Use this for initialization void Start () { } // Update is called once per frame v
using UnityEngine; using System.Collections; public class Tank : MonoBehaviour { //子弹预设体 public GameObject bullet; //发射点 private Transform firePoint; //移动速度 public float moveSpeed = 3f; //转身速度 public float turnSpeed = 3f; //横纵轴 float hor; float ver;