One of the the things we’re working on in our game is the ability to maneuver the real world in a number of ways. One of those ways is ledge climbing. If I reach the edge of something that’s climbable, can I climb it? I identified a few conditions for ledge climbing:
- Anything should be climbable if it can be
- I don’t want to put scripts on “climbable” objects
- I don’t want to put climbable objects in a separate layer
- I don’t want to use a specific tag to identify climbable objects.
Hence, I had to answer the fundamental question: “What is a climbable ledge?” I’m a big believer in the concept of visualization in game design for diagnosing what’s going on, so I started off with a simple system.
I used the Drawing Debug Extension plugin for actually drawing small arrows at runtime as part of my main loops rather than my OnDrawGizmos loop so that I could see what was going on. My initial step was to pick two spots in front of the player under my player’s hierarchy:.
Once my ledge detector initialized, I interpolated 10 points in between those two points and used those to trigger 10 downward raycasts.