How to compare Object#null to get_collider ouput in if statement?

Godot 4.4

I am currently attempting to make a first-person shooter, to do this I am planning on using raycast3D and when testing how it works I noticed it would always return that there is always a collision, and I put in code to output what has been colliding with, and when I did it outputted <Object#null>, what do I need to refer to Object#null as to use it in an if statement comparing it to get_collider?

if Shot.collide_with_areas == true:
			print("Collision!")
			print(Shot.get_collider())`

collide_with_areas doesn’t mean that it’s currently colliding, it means that the ability to detect areas is enabled. You want the is_colliding() function.

1 Like

thank you that worked perfectly

1 Like