I am trying check for a collision with the kinematic body 2d and an area 2d. I can't seem to find the function to do that.
I am trying check for a collision with the kinematic body 2d and an area 2d. I can't seem to find the function to do that.
First of all, both objects need a collision shape. You can then detect if the Body enters the Area with the function _on_body_enter.
Collisions are detected automatically, but you can code what your Area2D will do when the body enters its collision shape. Attach the script to your Area2D scene go to the node menu (part of the editor, where signals and groups are). Connect body_entered signal to itself. This will create a function in your script, which will be called every time, collision happens.
func _on_Area2D_body_entered(body): # _on_NodeName_body_entered(body):
pass
You can give that function your own name while connecting the signal in the editor. You can also connect signals in your script using connect() function. More about it here.