Error with collision between Rigid and Kinematic Body
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("ball"):<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("p1"):<br /> get_parent().get_node("player").ballCount += 1<br /> queue_free()<br />This works for some time, but sometimes I get the error:<br />
in the KinematicBody script.<br />Does anyone know what I'm doing wrong? <br />Thanks!Invalid call. Nonexistent function 'is_in_group' in base 'Nil'.