📅  最后修改于: 2022-03-11 14:48:55.888000             🧑  作者: Mango
//Even though Unity says that transform.forward = Vector3(0, 0, 1) that is not the case
//This is the line that you want
gameObject.GetComponentOfType().AddForce(transform.forward * 200,ForceMode.Impulse);;
//This line will give you seemingly random values
gameObject.GetComponentOfType(). AddForce(new Vector3(0, 0, 200, ForceMode.Impulse);