Hi I’m making a 2D platformer game and I’m trying to make an enemy that uses a ray to detect when it is going to go off a ledge is there a way to change the position of the origin of a ray cast depending on the direction the enemy is heading?
You will get a warning for line 40, two equals signs == is for comparison. The code says to compare DownRay’s position.x to itself times direction.x, then throw away the results. You also create down_ray_pos but it’s not really used so line 39 can be deleted, and you do not need to force a raycast update.
You probably want to multiply it’s position.x by -1 like you do with current_direction
$VisionArea/DownRay.position.x *= -1
Are you doing anything with this raycast? They do not operate on their own, what do you want this raycast to be used for?