This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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):
      var collider = RaycastRight.get_collider()
       head.rotation_degrees.z = lerp(head.rotation_degrees.z, wall_run_head_angle, 0.1)
       head.rotation_degrees.z = lerp(head.rotation_degrees.z, 0, 0.1)
Godot version 3.3.3.stable
in Engine by (20 points)

1 Answer

+1 vote
Best answer

Rather than checking consistently if the raycast has a collision you might want to move your code to a signal that emits when a collision happens.

P.S GDScript is case sensitive so know that obstacles, Obstacles, oBstacles are not the same thing

by (6,942 points)
edited by

Thanks for your answere! Ive now fixed it and it works pretty good.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.