To expand on this, and someone correct me if I'm wrong, pushing left or right expands the invisible collision box (or hit box), so that it registers an obstacle "collision". Without pressing left or right, the collision box is smaller, and doesn't collide with the obstacle's collision box.
That's the principle behind the barrel point award in DK, at least, and why sometimes you don't get the 100 point award when jumping a single, or get a 100 instead of 300 when jumping 2 barrels, etc, but if you press left or right, you get the full award.
Some good info on DK collision boxes here, which will give you a good general understanding of the principle:
https://donkeykongforum.net/index.php?topic=493.0;nowap