I’m making a game in which your character is just a rolling ball (RigidBody + SphereCollider). You can move left, right, forward, and backward via the arrow keys, which move the ball using the AddForce function on the RigidBody. (There’s also a jump, but this is not relevant to the question.) This works for the most part, except that it makes the ball appear to slide, rather than roll when it moves. So I tried also putting in an AddTorque function to make the ball rotate properly. This works as well, except that now it’s possible to push against and roll up a vertical wall! Using AddTorque alone doesn’t have this problem, but it also moves as slow as dirt (and does not allow any controls if the ball is not touching the ground). I like the feel of the controls using both AddForce and AddTorque, but I can’t allow wall-climbing. Any idea how to make that happen? I’ve tried tweaking all the physics material parameters, the mass, and friction and such, but nothing seems to completely prevent it. (I don’t want to just cast a ray and prevent movement if a wall is adjacent - you should be able to move along walls and up slopes, just not if the slope is steeper than, say, 45 degrees, although even steeper slopes should be possible if you get enough speed first - think Sonic the Hedgehog.)
Edit: Oh, also raycasting to make sure there’s no vertical surface in the way won’t work - because sometimes there are movable objects you’ll need to push, and you shouldn’t be able to climb up them either, if they’re against a wall. I’ve also tried adding a slight downward push to AddForce, but this either isn’t enough to keep it from wall-climbing, or it’s so strong it makes the ball bounce upward off the ground, doesn’t seem to be a comfortable middle ground.