I’m working on a game right now, and life would be so much simpler if I could emit a signal when a PathFollow3D crosses the progress mark of 1.0 and resets. This would signify the end of a stage, and I could then use it to pop up the end-of-level overlay.

Kind of like the finished signal for a sound.

Unfortunately, I can’t find any information on this.

  • SLOMOBO@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    There isn’t a signal because PathFollow3D doesn’t do anything on its own to move a Node. It just finds a point on the parent Path3D based on it’s progress/progress_ratio value.

    I would suggest wherever you are updating the PathFollow3D’s progress, add a check for:

    if path_follow.progress_ratio >= 1.0:
        # do something here, like emit a custom signal
    
  • Lil' Bobby Tables@programming.devOP
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    For the moment, I’m working around the apparent absence of such a signal by putting a collision shape at the end of the path. But, it really feels like it should be a thing.

  • Kylamon1@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    It’s not a signal, but it is a quick check. In 2d there is a (in godot 4) progress_ratio that scales from 0 to 1. So a quick

    If $pathfollow.progress_ratio==1: #I’m at the end of path end_of_level()

    This is what I did in my game.

    I don’t know the lemmy markup code for a code block so sorry for bad formatting