I am using unity and I am creating a 3d topdown game. There is no jump feature. The input handling supports only x and z axis player movement. Climbing slopes or falling from gaps is something I want to happen without certain input.
So, I have a rigidbody which I move by directly setting its velocity. When it goes up a slope it slows down.
I would like it to keep the same speed.
Now I do it like this:
void Update(){
moveInput = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
}
void FixedUpdate(){
MyRB.velocity = moveInput.normalized * runSpeed
}
I am using a capsule collider on the rigidbody and a box collider for the slope. The physics materials of the colliders are the default/none (not changed).