Raycast only hitting at freakishly specific distance

Godot Version

godot 4

Question

I’m working on an fps game and the raycast for my pistol is only registering at a very specific distance to the target

Here’s some print_debugs of the distance when the pistol registered a hit on an enemy:
8, Feet, Distance:0.53268575668335
At: res://Player_Controller/DosPistolasController.gd:64:_shootL()
9, Feet, Distance:0.53268575668335
At: res://Player_Controller/DosPistolasController.gd:64:_shootL()
10, Feet, Distance:0.53268575668335
At: res://Player_Controller/DosPistolasController.gd:64:_shootL()

note the distance to the target is identical for each despite several shots being taken from multiple ranges. it seems damage only registers from this exact distance. more specifically, I can wail on the enemy from anywhere on the map but it only registers if I’m that exact distance away. why?

Here’s the method that handles the raycast:

func _shootL():
	animL.current_animation = "new_animation"
	Blast.play(0.0)
	Shot += 1

## this is the important bit here
	if rayL.get_collider():
		if rayL.get_collider().has_method("_take_damage"):
			rayL.get_collider()._take_damage(dmg, 1, self.global_position, 5)
			print_debug(Shot, ", ", rayL.get_collider().get_name(), ", Distance:", position.distance_to(rayL.get_collider().position))

never mind, I parented the raycast to the wrong object on accident. not sure why it had this particular effect, but oh well. as long as it works

actually no its still doing it it just changed slightly

turns out I had an invisible collider that I didn’t think would stop the pistol but it did