How do you fix wall jump collision

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

The problem is the godot thinks that the player is near a wall when the player isn’t near the wall. I’m trying to get this to work for wall jumping like super meat boy. Here’s the code

(This is a comment) Possibly could have to do with the function _update_wall_direction

var move_direction = -int(Input.is_action_pressed(“left”)) + int(Input.is_action_pressed(“right”))
var wall_direction = 1
func _update_wall_direction():
var is_near_wall_left = _check_is_valid_wall(left_wall_raycasts)
var is_near_wall_right = _check_is_valid_wall(right_wall_raycasts)

if is_near_wall_left && is_near_wall_right:
    wall_direction = move_direction
else:
    wall_direction = -int(is_near_wall_left) + int(is_near_wall_right)

If anyone knows the problem let me know

:bust_in_silhouette: Reply From: kareem_farrag

if you want to check your raycast
write if $RayCast2D.is_colliding :
print (“collide”)

OR Remove raycasts and Replace it with
if is_on_wall and write if is_on_wall :
print (“is_on_wall”)