I assume you want to ease out the rotation of an object. So your easing function returns a value between 0 and 1 based on time.
You would have the current rotation as well as the target rotation of the object. In your Tick event you would call the easing function and set the rotation to a percentual value of the target rotation.
// get current rotation of object
FRotator rotationBeforeEasing = this->GetActorRotation();
// set your target rotation to whatever you like
FRotator rotationAfterEasing = FRotator(rotationBeforeEasing.Pitch, rotationBeforeEasing.Yaw+40.f, rotationBeforeEasing.Roll);
// difference of rotations
FRotator deltaAngle = rotationAfterEasing - rotationBeforeEasing;
void AMyActor::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
...
// your condition to start/stop easing
if (...)
{
// get linear interpolation value between 0..1
float val = EaseOutElastic(DeltaSeconds);
// calculate new rotation based on easing function
FRotator newRotation = rotationBeforeEasing + val * deltaAngle;
// set new rotation
this->SetActorRotation(newRotation);
}
}
I didn’t test it but I am doing something similar in my project. I use a TimeLine asset which I play and stop on certain conditions
Also, I think the Tick event could make some trouble because your easing function needs input parameters starting at 0 but when calling the function with DeltaSeconds from the Tick event, this could not be the case.
Maybe you’re better of using a Timer with GetWorldTimerManager().SetTimer(...) (see FTimerManager) which calls a function every x seconds and does the rotation easing of your object.