public float speed = 6f;
Vector3 movement;

void FixedUpdate () {

float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");
Move(h,v);
}

void Move(float h,float v)
{
movement.Set(h, 0f, v);
movement = movement.normalized * speed * Time.deltaTime;
GetComponent<Rigidbody>().MovePosition(movement+transform.position);//当前位置+移动的位置
// transform.position = movement + transform.position;//与上一行一样的方法

}

04-14 23:36