My character is controlled as a third person character from a very top down perspective. When my character walks into an object or wall, it sticks to the wall. The character will only slide along the wall once it is at about 70 degrees (if facing the wall directly is 0 degrees).
The behaviour that I would like to see, is that if the character runs into a wall or object and is facing at least a 45 degree angle to the wall, that the character will slide along the wall and not just stay stationary while playing the walking animation.
Here is my code. Any help pointing me in the right direction is appreciated!
/*essentially, I am just using addrelative force in fixed updated for forward/back, strafe left/right. I also have a rotation bit, but it is in the Update function as it only uses transform.rotate.*/
void FixedUpdate()
{
strafe = Input.GetAxis("Strafe") * speed;
translation = Input.GetAxis("Vertical") * speed;
strafe *= Time.deltaTime;
translation *= Time.deltaTime;
ply.velocity = newVector3(0, ply.velocity.y, 0);
ply.AddRelativeForce(newVector3(strafe, 0, 0), ForceMode.VelocityChange);
ply.AddRelativeForce(newVector3(0, 0, translation), ForceMode.VelocityChange);
}