示例#1
0
    private void Update()
    {
        var h = Input.GetAxis("Horizontal");
        var v = Input.GetAxis("Vertical");

        if (moveOnXZ)
        {
            xrb.AddForce(new Vector3(h, 0, v) * force);
        }
        else
        {
            xrb.AddForce(new Vector2(h, v) * force);
        }
    }
示例#2
0
 public void AddForce(Vector3 force)
 {
     rigidbody.AddForce(force);
 }