posted a post
Oct 28, 2018 11:20 AM
In our project we implemented physically based platforming with a combination of jumping and 'hopping'. A hop is a low impulse, assisted jump that's used to overcome features of the terrain - complementing a capsule or ball's natural tendency to climb steps.
Medium sized (15~40cm) obstacles are detected in this way with avatars (including PC and most NPCs) jumping over that without further user input or scripting.
Later I realized that jumping and hopping interacted in interesting, not always wanted ways.
In one case it was possible to jump after a hop had started. This causes problems with unpredictably outsized jumps; we defend against this by subtracting the hop impulse from the jump impulse.
Another case is when a jump almost (but not quite) reaches an edge. In this case a hop organically triggers. More fluke than bug; classic platform games tend to resolve 'ties' in the player's favor so I decided to keep this.