hit normal vector from raycast is always [-1,0], which makes slope angle 90

I am quite lost and probably missing something. I am trying to get angle between ray cast and vector2.up.

Problem is, that hit.normal is always [-1, 0] which does not make sense to me.


You can ignore red lines. Black cross is hit.point - where a ray hits the target. If I debug it by hit.collider.name I can see, that I hit expected collider.
In this case rayOrigin lays on the same coordinates as hit.point.

Any hints appreciated.

Hi @Izmail360

Your question is bit unclear, you didn’t mention if this is 2d or 3d physics, but based on image and use of Vector2, I assume it is 2d…

I already added a comment, but here is an answer.

a. Start your raycast from within your character, not from a point where you expect to hit something.

b. Make sure you player is not colliding with raycast. Put your player in different layer. If your ground is in layer “platforms” for example, make your player be in different layer, and use “platforms” as raycast mask.

I tested this and it works.