Collisions for a 2D platformer




I’m experimenting with building a 2D platformer based on ncollide. I’ve been experimenting with the library and am trying to work out how to model a character that can detect whether it is landing on the ground/hitting a wall/hitting a ceiling etc.

I’ve seen existing solutions that do collision detection with an array of points around the player object, like this:

but I’m not sure how to best emulate this in ncollide. I have been experimenting with a simple Cuboid collider but this makes it difficult to determine whether the contact points are on the base, top or sides.

My current plan to handle sloping floors is to just depenetrate the character in the direction of the collision normal when it starts to clip into the floor.

Does anyone have any suggestions or ideas for how to approach this problem?