Instantiation doesn't work for me

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

Hi guys I have a small problem, I am trying to instantiate a missile from several Position2D objects that I have placed around a platform. The problem is that when I instantiate a missile and then add it with the addchild() method as a child of a Position2D it instantiates it somewhere else! Can anyone tell me why or can you help me figure out where I’m going wrong?

is your missile scene positioned at Vector2.Zero? and not somewhere else? Check the transform. Or after instantiate you could set the spawn position:

missile_instance.transform.origin = spawn_position

Wurzelpilz | 2021-08-06 13:05

Putting the transform of the missile at coordinates(0,0) worked. Now it instantiates the missile. Thanks

Peppe | 2021-08-06 18:21