Hello,
I am currently working on the wall run mechanic in my fps game. I am doing this with Raycasts at the left and right of the character, but it won't work. Here is my code:
onready var RaycastRight = $RayCastRight
onready var head = $Head
var wall_run_head_angle = 20
func _physics_process(delta):
if(RaycastRight.is_colliding()):
var collider = RaycastRight.get_collider()
if(collider.is_in_group("Obstacles")):
head.rotation_degrees.z = lerp(head.rotation_degrees.z, wall_run_head_angle, 0.1)
else:
head.rotation_degrees.z = lerp(head.rotation_degrees.z, 0, 0.1)