Hi, I have a pawn that interps current location to where the Camera Manager is at:
Is there another way to check if interpolation has finished besides using an Epsilon check?
Maybe store in a variable to compare if current location is equal to the location of previous frame?
Thanks.
That’s all you can do I’m afraid. At least if you use variables, you aren’t getting the locations twice.
The only other way I can think of is…
Do:
LocationA - LocationB
Get the Length the resulting Vector and check if it’s length is below a Threshold Value (0…infinity).
Another way would be, to use a timeline to do the interpolation alpha value for you.
This stopps at an alpha of 1.0 and can only be restarted to do another location interpolation.
Not sure why you would want to? Interpolating from 0 … 1 is how interpolation works.
You could do something like continually compare positions but that is the same thing but less efficient.
Thanks for the replies.
Before trying interpolating through event tick, I was using a timeline with a float Alpha from 0-1, but as I’m using SetWorldOrigin, and the distance from A to B is huge, it triggers SetWorldOrigin while interpolation is still running, which causes some heavy stutters because the variables change value mid transition.
That’s because Lerp uses A to B and not Current to Target locations as InterpTo does.
If you have experience with World Rebasing, I’d like to give Lerp another try.
This is how I’m triggering SetWorldOrigin: