How to determine which collision layer collided?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Levi Lindsey

I’m creating fall-through platforms in a simple 2D platformer. For the most part, I’m using the technique described by Diet Estus in this answer.

However, that answer recommends using a downward raycast to get information about the type of floor. Maybe that is the best option for this, but it seems like there ought to be a simpler way. Ideally, there’d be a layer property on KinematicCollision2D, but that’s not part of the API.

Is there a simpler way (other than using a raycast) for me to determine which collision layer the player is colliding with?