How to detect which side of my player has collided?

I need to detect, OnCollisionEnter(), whichside of my player is colliding. I’ve tried some things, and searched a LOT, but everyone either say:

Use the contact points normals.
Raycast and get the normals.

For me they sound okay-ish if you want a vague description of where you are colliding (i.e. Top, Bottom or Sides). But I need to detect if the player is colliding at the front to climb walls, if he’s colliding at left or right he’ll do something else, and it goes on and on.

PS: I don’t want to use multiple colliders as well… that’s not an option in my case, unfortunately.

Thanks in advance.

Good day.

I’ve never needed to know where is the collision, but what i think is once you have the 2 objects that are colliding, you can create a vector from player center (local 0,0,0) to object, (as this post explains) and check wich components of the vector are positive/negative/zero relative to the player center point.

This way you can know if its right, left up, top, front or back ! :smiley:

If helped, accept the answer :D


On the collision you get the collision position.
You can transform that point to the players local space and you get a vector that tells you in what direction seen from the player the collision did accrue.