Using rigidBody.velocity to move a character

I’m trying to use this code to move character left/right

rigidBodyComponent.velocity = (movement * movementSpeed) + new Vector3(0, rigidBodyComponent.velocity.y, rigidBodyComponent.velocity.z);

but the issue I’m having is that when the character is in the air and moving left into a wall, gravity doesn’t force it down. Instead they continue to try to move until input is zero;

As you can see in the picture, he is kind of just floating there while input isn’t zero. s soon as movement equals Vector3.zero, the character would fall. Any insight would be very much appreciated.

(Random guess)
Maybe he’s sticking in the wall, Try frictionless physics material?

That causes the character to slide all over

you need to constantly be adding gravity to velocity…

using velocity is a bad way to do it. MovePosition would be better

MovePosition will cause your character to teleport through things though however.

have u tried:

rigidbody2D.AddForce(Vector2);

velocity is not recommended for movement… by setting velocity constant u are forcing body to have constant velocity thus ignoring the effect of gravity force or any other force and in turn all accelerations.

Thanks, what I ended up using was AddForce and using Acceleration forcemode as well as a constant downward vector for gravity.