For my platforming movement I need to keep track of two simple checks (for now):
- If the player is standing on a block then they’re counted as on the ground and the animation changes, various flags are updated, etc
- If the player hits their head on the ceiling then their jump is cut short early
The character itself uses a box collider with simple physics. My solution was to create head and feet trigger colliders that poke slightly out the top/bottom of the main collider and are slightly thinner, so that in theory they only collide against ceilings/floors. See diagram: Imgur: The magic of the Internet
However I find that sometimes these triggers are hitching against walls as well - i.e. I jump diagonally into a wall and sometimes the player box collider will briefly slip inside the wall’s box collider, triggering a collision on the head or feet collider and screwing up the physics.
Anybody have any idea why this happens? How do I guarantee that two box colliders will definitely never overlap at all, so I can prevent inappropriate collisions with the triggers? Or is there a smarter way to do this?