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); } }
public void AddForce(Vector3 force) { rigidbody.AddForce(force); }