Error with collision between Rigid and Kinematic Body

deldel Posts: 20Member
edited August 2016 in 2D
Hello!<br />I have a KinematicBody2D and a RigidBody2D, which should be deleted, if either it hits the KinematicBody or the KinematicBody hits it. First I thought it would be enough to check the collision from only one of the bodies, but that didn't work. So I checked from both of them.<br /><br />From the KinematicBody I checked with:<br />
if is_colliding():<br />		var body = get_collider()<br />		if body.is_in_group(&quot;ball&quot;):<br />			ballCount += 1<br />			body.queue_free()
<br /><br />and from the RigidBody I checked with the signal:<br />
func _on_ball_body_enter( body ):
<br />
if body.is_in_group(&quot;p1&quot;):<br />		get_parent().get_node(&quot;player&quot;).ballCount += 1<br />		queue_free()
<br />This works for some time, but sometimes I get the error:<br />
Invalid call. Nonexistent function 'is_in_group' in base 'Nil'.
in the KinematicBody script.<br />Does anyone know what I'm doing wrong? <br />Thanks!

Tags :
Sign In or Register to comment.