Collision doesn't spawn

I made a code to spawn an object when another onject is hit by a bullet, however, I noticed that the object spawns with the collision not working properly, and objects that would otherwise collide with it don’t . What’s happening?

func _process(delta):
	if global.button_pressed == true:
		var newshoot = porta2.instantiate()
		get_tree().root.add_child(newshoot)
		newshoot.global_position = global_position

The code looks fine (although spawning the objects as child nodes of the root instead of the main scene is a bit… unusual). You should check the remote tree to find out if…

  • the collision shapes actually exist
  • their disabled property is set to false
  • and collision_layer and collision_mask make sense
2 Likes