Get_wall_normal() not outputting a y value

Godot Version

Godot 4.3

Question

I am having a problem with get_wall_normal().
What i am trying to do is when whenever a characterbody2D collides with something (Example: a wall) it will detect the normal of the wall so I can use it to reverse the velocity in that direction.
So if the velocity was Vector2(10 , 0) and it collided
with a normal of Vector2(1 , 0), then the velocity would be set to Vector2(-10 , 0)

The problem is that when the characterbody2D collides with an what should be an x normal (Left and right), get_wall_normal() returns fine, but when it collides with what should be a y normal (Up and down) the function does not update and returns whatever it was before

Am I not understanding what get_wall_normal() does or is there something wrong with my code?

Screenshot 2024-09-07 153611

Screenshot 2024-09-07 153216

Is your character’s Motion Mode set to floating?

nope but I set it to floating and it works, thank you. I delved a bit into it and understood why a bit after.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.