Bullets don't collide with most of the kinematic bodies

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

So i was making my first simple fps game . And after coding the bullets , it always collide with the fist kinematic body but then it rarely collide with the others . Here is an example

In my code the Ennemies(Kinematic Body) always register when it collide for the score so i guess the problem is with the bullets code :

extends Area
var speed = 100
var velocity = Vector3()
onready var timer = get_node("Timer")

func start(xform):
    transform = xform
    velocity = + transform.basis.x * speed

func _process(delta):
    transform.origin += velocity * delta

func _on_Bullets_body_entered(body):
    if body.get_name() == "Ennemy1":
        body.queue_free()

func _on_Timer_timeout():
    self.queue_free()			
:bust_in_silhouette: Reply From: UnRealCloud 1
func _on_Bullets_body_entered(body):
    if body.get_name() == "Ennemy1":
        body.queue_free()

The problem must comes from the condition, I guess all your enemies haven’t “Enemy1” as name in the node tree.
You should change this condition.

For example you could add your enemy in a group and check if the body belong to this group.
https://docs.godotengine.org/fr/stable/getting_started/step_by_step/scripting_continued.html#groups