How do i flip a raycast?

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

Im making a skeleton that speeds up if a raycast hits the player. and im trying to make the raycast flip when it hits a wall:

   if is_on_wall():
	$PlayerDetector.position.x *= -1

it doesn’t work and I don’t know what else to try. it worked for a different raycast and I don’t know why its not working for this one

:bust_in_silhouette: Reply From: exuin

The issue is that that doesn’t change the direction of the raycast, just the position. Change the scale instead of the position or cast to another location.

how do i do that?

Bacon_Gb12 | 2021-04-24 12:10

$PlayerDetector.scale.x *= -1

or something like that

exuin | 2021-04-24 14:34