Why is my kinematic body sticking to the wall when wall running

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

I am making a Fps and when my character starts wall running it seems to want to stick to the wall. when i try to jump off the wall it still sticks to the wall. how do I fix this

Here is the code:
func process_wallrun():
if can_wallrun:
if Input.is_action_pressed(“ui_right”) and is_on_wall():
var collision = get_slide_collision(0)
var normal = collision.normal
var wallrun_dir = Vector3.UP.cross(normal)
var player_view_dir = -camera.global_transform.basis.z
var dot = wallrun_dir.dot(player_view_dir)
if dot < 0:
wallrun_dir = -wallrun_dir
wallrun_dir += -normal * 0.01
is_wallrunning = true
gravity = 10
direction = wallrun_dir
if Input.is_action_pressed(“ui_left”) and Input.is_action_pressed(“jump”):
is_wallrunning = false
if Input.is_action_pressed(“ui_left”) and is_on_wall():
var collision = get_slide_collision(0)
var normal = collision.normal
var wallrun_dir = Vector3.UP.cross(normal)
var player_view_dir = -camera.global_transform.basis.z
var dot = wallrun_dir.dot(player_view_dir)
if dot < 0:
wallrun_dir = -wallrun_dir
wallrun_dir += -normal * 0.01
is_wallrunning = true
gravity = 10
direction = wallrun_dir
if Input.is_action_pressed(“ui_right”) and Input.is_action_pressed(“jump”):
is_wallrunning = false
gravity = 20

		else:
			is_wallrunning = false
			gravity = 20