Godot Version
godot 4
Question
I have a shotgun that iterates through a series of raycast3d nodes to check for damage whenever you shoot. for some reason none of these raycasts return anything. here’s my code:
func _process(delta):
if Input.is_action_just_pressed("Shoot") && ammo > 0 && get_parent().name == "playerHands":
ammo -= 1
anim.play("Flash")
for ray in rayParent.get_children():
if ray.is_colliding():
print(ray.get_collider().name)
if ray.get_collider.has_method("takeDamage"):
ray.get_collider.takeDamage(throwDmg, ray.get_collider)
else:
print("not hitting")
everytime I shoot, regardless of what I’m pointing at, I get “not hitting” printed to console. I’m certain my collision masks are set up correctly to hit what they’re meant to, what’s the issue?