public LineRenderer 线渲染器; public Vector3[] 线的点们 = new Vector3[60]; public Transform 发射点; public float 力度=10; public float 细分长度 = .02f; public GameObject 子弹; void Update() { for (int fFor = 0; fFor < 线的点们.Length; fFor++) { 线的点们[fFor] = 发射点.position + 发射点.forward * 力度 * fFor * 细分长度 + Physics.gravity * (0.5f * (fFor * 细分长度) * (fFor * 细分长度)); } 线渲染器.positionCount = 线的点们.Length; 线渲染器.SetPositions(线的点们); if (Input.GetKeyDown(KeyCode.Space)) { GameObject 暂存 = Instantiate(子弹, 发射点.position, 发射点.rotation); 暂存.SetActive(true); 暂存.GetComponent<Rigidbody>().AddForce(发射点.forward* 力度, ForceMode.VelocityChange); Destroy(暂存,5); } }
标签:VelocityChange,点们,ForceMode,fFor,质量,暂存,public,发射点 From: https://www.cnblogs.com/porter/p/18407673