Positioning doesn't work properly

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

I have this boss enemy that shoots 5 bullets when this function is triggered. The bullets gets spawned but the positioning of then is always wrong, I want it to spawn bullet in 5 spawn positions which are children of the boss but it spawns them at origin. I tried changing the line that ends with “*********” a lot and tried every combination of “position” and “global_position”.

I use the same logic for player bullets(only diffrence there that player shoots 1 at a time) and it works fine but I really have no idea why it doesn’t work for boss enemy.

 for i in $Shoot.get_children():
	var bullet_ins = bullet.instance()
	
	bullet_ins.global_position = i.global_position***
	bullet_ins.rotation = i.rotation
	
	bullet_ins.active = true
	
	get_parent().get_parent().add_child(bullet_ins)
	
	bullet_ins.update_stat(5, 20000, 3)
	print("shoot")
:bust_in_silhouette: Reply From: Inces

set position after adding it as a child