Announcement

Collapse
No announcement yet.

Does anyone know why FInterp returns different values when using local variables?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Does anyone know why FInterp returns different values when using local variables?

    Click image for larger version  Name:	GlobalLocalFunction.png Views:	2 Size:	209.1 KB ID:	1669485

    Why aren't these functions returning the same value? I'm trying to better organize my blueprints by moving certain things into functions but if the behavior changes when I use local variables then I have to use a global variable an it's not as clean as I'd like it to be.

    video showing the behavior of the bp.
    https://youtu.be/Cp9rs4RU8MI
    Attached Files
    Last edited by IndieGameCove; 09-30-2019, 01:05 PM.
    YT Channel: https://www.youtube.com/channel/UCoc...KYPSK6g7vZ5CNg

    #2
    The difference in output is due to the local variable being reset to 0.0 (when the variable gets initialized) every time the function is being executed. As a result, in the local scenario, it's always trying to interp from 0 to target, while in the global scenario, it's doing so from last updated value to the target.
    Tower Defense Starter Kit (v2.10) | Line of Sight Visualization | Top Down Stealth Toolkit

    Comment


      #3
      ooh.. makes sense. Thanks.
      YT Channel: https://www.youtube.com/channel/UCoc...KYPSK6g7vZ5CNg

      Comment


        #4
        Local variables only exist within the scope of the function.When the function returns/ends the local variable is cleaned up. A member/global variable remains in scope as long as the Class/Blueprint exist.
        Last edited by GarnerP57; 09-30-2019, 03:27 PM.

        Comment

        Working...
        X