This works fine, but if horizontal movement is constantly applied against a “wall” and then the player jumps (with AddForce function), the player can then jump up the wall. I tried:
I’m not ENTIRELY sure what you mean by jump Up the wall, but i think you’re saying that the user can press jump repeatedly as long as they’re touching a wall, and they’ll keep going up, right?
If so, it sounds like your code is only checking whether the player is touching any surface, rather than if they’re specifically touching a floor. You’ll need some more advanced checking of collisions to determine where the surface is, relative to the player. Or perhaps just use the tagging system if your game is simple enough, you could tag certain parts as floor, some as Wall, and use the tags to differentiate between them.