my bullets doesn't always collide with 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 fps game . after coding the bullets and testing it the fist bullet always collide but then it rarely collide

fps game - Album on Imgur

the ennemies(kinematicbody) works fine in calculating 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":

func _on_Timer_timeout():

do the bullets realy intersect the boxes? or are they “jumping” through the boxes because of their speed?

klaas | 2020-07-17 17:18

yea they interact with some

MaskedKasper | 2020-07-18 17:43

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

All your enemies haven’t the same name in the node tree, so

body.get_name() == "Ennemy1":

will return true with the first Ennemy1 instantiate but will return false with the others ( their name will be increment by one),

. You should change your condition.

For example you could use groups.