Hello, I am new to godot and trying to learn as I go. Since three days now I am trying to figure out what's going on.
#remove from group to avoid trigger area
player_character.remove_from_group("Character")
#do some code to instantiate a new room here
#reposition the player to the door
player_character.global_position = door_pos.global_position
#re-add to group to re-enable triggering
player_character.add_to_group("Character")
The thing that I noticed is that the player_character does not seem to be going to the correct position before being re-added to the group. As if, adding the group happens before the change in position.
If I add a create_timer before the add_to_group, it works well.
await get_tree().create_timer(1.0).timeout
If I add defer, it doesn't.
I am not quite grasping why it is behaving this way and wether create_timer is usually a good solution as it feels a bit odd to put it that way, any ideas?
Thanks!