public class pull : MonoBehaviour
{
// Start is called before the first frame update
public Rigidbody ri;
void Start()
{
ri = gameObject.GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
if (Input.GetButton("Fire1"))
{
//rb.AddForce(1,0,0)//默认是ForceMode.Force
//v=a*t
//ri.AddForce(2,0,0,ForceMode.Acceleration);
//P=m*v
//ri.AddForce(1,0,0,ForceMode.Impulse);
//v 速度增量
ri.AddForce(0.02f,0,1,ForceMode.VelocityChange);
}
}
}
unity 刚体的运动 加力运动
最新推荐文章于 2023-10-20 16:59:21 发布