I'm trying to instantiate object(scene) and set it's spawn position at the spawn time. Here's the code I wrote:
func spawn_asteroid(): var spawn_position: Vector3 = get_spawn_position() var asteroid_instance = asteroid_scene.instance() asteroid_instance.transform.origin = spawn_position spawned_asteroids.append(asteroid_instance) add_child(asteroid_instance)
asteroid_scene is PackedScene, so get instance first, and then update it's position, and finally use add_child to append current scene's tree.
It seems fine to me, however when I run the game, the object was spawned at (0,0,0) and then move spawn_position.
I changed it's position before it appended to scene, but why it still (0,0,0) and right after move to the specified position?
In Unity, change object's location right after instancing works. In Godot Engine, is this approach invalid?