I’m trying to move the player’s model from its starting position to its melee target’s location within InterpSpeed seconds. This looks good, but movement is really slow, it takes several seconds to move 200 uu:
void UCombat::FlowTowards(float FrameDeltaTime){
if (myActor != nullptr && combatTarget != nullptr){ //Sanity check to prevent Persona crashing
FVector destinationLocation;
FVector FlowEndLocation;
FVector FlowStartLocation;
FlowStartLocation = myActor->GetActorLocation(); //Start interpolation at player's location
FlowEndLocation = combatTarget->GetActorLocation(); //End interpolation at target's location
float InterpSpeed = 0.5f;
destinationLocation = FMath::VInterpTo(FlowStartLocation, FlowEndLocation, FrameDeltaTime, InterpSpeed); //Move from start-finish in 0.5 seconds
myActor->SetActorLocation(destinationLocation,true); //Set the player's position to the calculated value
}
}
I’m assuming the problem is that my InterpSpeed is too low, but that in turn implies that VInterpTo doesn’t work like I thought it did- is there a way to calculate what value the speed needs to be set to, in order to cover an arbitrary distance in a given period of time?