How do you solving changing scene with collision is progress ?

GarromOrcShamanGarromOrcShaman Posts: 174Member

Hi all. I'm using get_tree().change_scene to change current level. Every time i do so i get two errors. Condition ' !area_in && !E ' is true and Condition ' !body_in && !E ' is true. I know that both errors are about player colliding with portal, after all, this is what trigger change of scene. How do you can go arond these problems ? call_deferred or yield(get_tree(),"idle_frame") does not work and i wondering if is there any solution for this.

Tagged:

Tags :

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 892Admin
    Answer ✓

    You just need to use this!

    func change_scene_areas(scene_path):
        set_areas_false(get_tree().root);
        get_tree.change_scene(scene_path);
    #
    func set_areas_false(node):
        if "monitoring" in node:
            node.monitoring = false;
        for child in node.get_children():
            set_areas_false(child);

    Then just call change_scene_areas instead of change_scene. The error is printed when you try and change scenes with Area nodes that have their monitoring property set to true.

    You'll also get the same error if you free a Area node when it's monitoring property is true, so if/when you remove Area nodes, you'll want to make sure monitoring is false before calling queue_free.

  • GarromOrcShamanGarromOrcShaman Posts: 174Member

    @TwistedTwigleg said:
    You just need to use this!

    `
    func change_scene_areas(scene_path):
    set_areas_false(get_tree().root);
    Quote was shorted to prevent wall-o-text

    So this is how GoDot workflow looks like ?Thanks a lot. I bookmarked this and finally starting to understand how GoDot works under hood. True, i can look at source, after all, this is what is most awesome about GoDot but i know GML, C# and learning GDscript.I once tried to look at source but c++ seems like elvish language to me.

  • TwistedTwiglegTwistedTwigleg Posts: 892Admin

    So this is how GoDot workflow looks like ?

    Yeah, I guess so. I only recently figured out this little trick to fixing the bug :smile:

    Thanks a lot. I bookmarked this and finally starting to understand how GoDot works under hood.

    Happy to help!
    Knowing how Godot works under the hood is definitely useful, especially when working around (or fixing) bugs.

Sign In or Register to comment.