Player controller - how to stop the sliding

Currently I have a custom player controller for movement. As I am building a network game, I would like to have as little physics as possible. Right now, when I move player up the hill, player slides down. Predictable.

This is my handler right now. I am manually changing the position of the player based on its velocity in the update function, as you can see.

      Direction moveDirection = DPad.MoveDirection();
      Vector3 velocity;
      if (moveDirection == Direction.N)
        velocity = new Vector3(0, 0, 1);
      else if (moveDirection == Direction.S)
        velocity = new Vector3(0, 0, -1);
      else if (moveDirection == Direction.W)
        velocity = new Vector3(-1, 0, 0);
      else
        velocity = new Vector3(1, 0, 0);
      
      GetComponent<Rigidbody>().position += velocity * CalculateSpeed() * Time.deltaTime;

Is there some way to make the player not slide down anything - and even better, when a player moves into a wall at an angle, let’s say, is there an easy way to stop the player right there, instead of allowing it to move along direction of the wall?

Well if you’re determined to use velocity to control the character you could enable a movement constraint on the Rigidbody when none of the buttons associated to moving aren’t pressed. This should lock the player in place if you aren’t trying to go anywhere. Have a look at this.

I would strongly advise using a CharacterController to take care of player movements though. I believe in the example FPS Controller that Unity provides they use a CharacterController that can still react with its Rigidbody. I would check that out. This is a pretty good video comparing the two methods.

use a higher friction physics material.

The problem might be the slope limit too. I would check it out and put it up to 85 degrees.