Using Member Functions
We are going to be using member functions and a GetSafeNormal function that will let us get a hold of a direction of a particular vector.
Right now our platform is going back and forth, but if we increase the speed of the platform it will not properly move back to it’s correct distance. So we now must calculate from the original start location to get to the new one.
We are going to need to get the normal of our vector to get our speed and distance moved correct.
We are going to create a new vector that let’s us know our direction moved = our platform velocity with a normalized vector
We are then going to set our start location = startLocation + our moved direction + moved distance.
We then set our actor’s location as the start Location.
Once our platform has reached the distance moved > then the moved distance we are going to go back to our starting location, by setting the velocity negative.
Our platform is now free of a potential bug of going past it’s original location.