raycast 3d not working

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

got this error with this code

Attempt to call function 'is_in_group' in base 'null instance' on a null instance.

func _process(_delta):
if is_colliding():
	var body = get_collider()
	if !body.is_in_group('player') and body.has_method('on_hit'):
		if body.hp - damage <= 0:

It looks like the variable body is null in the code. Did you try running the code in the _physics_process() function?

Ertain | 2020-09-20 15:56