Is running or at end

  • Is there a way to check if the object:

    1. Is on move.
    2. Stopped at the last waypoint after forward move.
    3. Stopped at the first waypoint after reverse move.

    1. splineMove.tween != null would be sufficient in most cases. If you pause the tween during gameplay, add && splineMove.tween.IsPlaying() as an additional statement.

    2. & 3. The "currentPoint" variable is the current active waypoint index. First waypoint: currentPoint == 0, last waypoint: currentPoint == waypoints.Length - 1.
      In case of "ping pong" movement, the "reverse" boolean indicates the current direction. However, this is reset immediately after reaching the final waypoint.

    If you wish to not only check for these states at a given time, but also receive events at the time they happen, please look into waypoint events.

Log in to reply