Possible improvements for FMath::VInterpConstantTo code

Hi everyone,

I would like to suggest the next improvements:

  • to move the calculation of both Speed and TargetLocation to BeginPlay method (storing both in global variables instead of OriginalLocation, which can be local). Since all variables: OriginalLocation, MoveOffset and MoveTime are all final, there is no need to recalculate them every frame and so it seems better for performance not to do (although it does mean that an extra global variable has to be stored)
  • to add to the if a check if we are not yet at the targetlocation, so only execute this code when needed

If you don’t agree with these points, please let me know.

1 Like

Privacy & Terms