How can I check if the object I collided with is a KinematicBody2D??

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

I need to check if the object the script is on has collided with a KinematicBody2D.

I can’t use the area_entered signal because I already used that for something else and it just wouldn’t work.

Any suggestions?

use signal area
func _on_Area2D_body_entered(body):
if body is KinematicBody2D:
print(“bla bla”)
Note : i think Area_entered hard except

ramazan | 2021-12-31 12:51

how can I get the name?

David000 | 2021-12-31 16:30

print(bla bla )

ramazan | 2021-12-31 16:51

func onArea2Dbodyentered(body):
if == "node name’:
print(“bla bla”)

ramazan | 2021-12-31 16:53


David000 | 2022-01-01 14:34

:bust_in_silhouette: Reply From: aengus126

I am a little bit confused. You should be able to connect multiple signals from one node, so long as you change the name of the signal and the connected function so that it’s not being picked up by other code. You say that you want to check if the object has collided with a Kinematic Body but you also say you can’t use the area_entered - the area_entered signal would only emit if your object has collided with an area, not a kinematic body. the body_entered signal would be more likely to work.