Wall Run / Climb

This time I need some help with a free run part of my game. I want to make it so if the player hits/jumps onto the wall from the front, it will start running up the wall. If the player hits the wall at an angle, it will start running along it (with ability to start running up the wall). After a set amount of time, the character should fall off the wall.

Right now, my guess is that I need to use raycasts to check where the wall is for the player, then do something so the player defies gravity and begins running the wall.

Thanks

This depends on your character controller. If it is a rigidbody using gravity, you have to disable it the moment you touch the wall. If it is a custom one, just modify the y value of the movement.

Detecting a (climbable) wall is possible with a couple of means, some can be combined:

  • Collision detection and checking the objects normal y value ( between -0.1 and +0.1 for a wall)
  • Collison detection and checking the objects tag (e.g. a wall tag)
  • Placing a trigger in front of the wall and change gravitiy within this area
  • Use a second UV map and assign one of the color channels to distinguish spots on a wall that are climbable (much work)
  • Use raycasting from your head up forward for a ceiling and a second one from top down forward if there’s a area you can climb onto

Hope that helps

@Nanity, my character is controlled in FPS and it doesn’t use Rigidbodies for movement and gravity. And I want my character to wall run on specific materials. How would I do that?