Dynamic height vaulting?

Here is one approach you could try to determine the ledge height:

  1. Shoot a horizontal ray towards the direction of the wall (hit point: hPos)
    to detect the x-position of the wall
  2. Shoot a vertical ray downwards from the hPos + epsilon to detect the
    y-position of the ledge
  • epsilon: a small value that is used to avoid an edge-case where the ray narrowly avoids the target due to a floating-point error.

image

After this info is obtained, it’s just a matter of performing an animation at a specific position relative to the obtained point.