How can my character move horizontally with Rigidbody.MovePosition?

How can i make my character go right and left? It only moves up and down. The Rigidbody is kinematic and I want to move him in a plane. Thanks!

P.S. I’m very new to this.

void FixedUpdate()
{
float h = Input.GetAxis(“Horizontal”);

    rb.MovePosition(transform.position + transform.right * h * speed);

    float v = Input.GetAxis("Vertical");

    rb.MovePosition(transform.position + transform.up * v * speed);
}

}

I think you might be overwriting the first call. :slight_smile:

float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");

rb.MovePosition(transform.position + (transform.right * h + transform.up * v) * speed);

Thank you so much @TreyH!!! :slight_smile:

My object started going up so keep the speed 0 and your object will only move horizontally.