Smoothly move skeletal mesh from A to B

Sorry for noob question guys,

How do I smoothly move my skeletal mesh in some direction smoothly with some nice ease over time? I tried using FMath::VInterpTo in a Tick function but it still snaps to that new position the moment it is called:

InitialMeshRelativeLocation - is my current skeletal mesh’s location (FVector)

GetMesh()->SetRelativeLocation(InitialMeshRelativeLocation + FMath::VInterpTo(InitialMeshRelativeLocation, FVector(0, 0, 50), DeltaTime, 15));

Can you please help?

With animation or just translation? Just the skeletal mesh or the entire actor?

Assuming translation and only the skeletal mesh component, then, try MoveComponentTo.

Yeah I need just translation - the capsule should stay intact.

You mean this one?

static void MoveComponentTo(USceneComponent* Component, FVector TargetRelativeLocation, FRotator TargetRelativeRotation, bool bEaseOut, bool bEaseIn, float OverTime, bool bForceShortestRotationPath, TEnumAsByte<EMoveComponentAction::Type> MoveAction, FLatentActionInfo LatentInfo);

Yes…

For example, to move the mesh upwards 1000 units:

Mesh->SetRelativeLocation(FMath::VInterpTo(Mesh->GetRelativeLocation(), FVector(0, 0, 1000), DeltaTime, 2.0f));

Ok thanks I will try!

Ok I finally got it moving but for some reason in order for the Skeletal Mesh to stick to the floor I had to add that VInterpTo to some intially lower FVector value:

GetMesh()->SetRelativeLocation(FMath::VInterpTo(GetMesh()->GetRelativeLocation(), **FVector(0.f, 0.f, -90)** + FVector(0.f, 0.f, -NukaZOffset + 10.f), DeltaTime, 15.f));

Thanks a lot for your advice!

But just out of curiosity, is it actually possible to move that skeletal mesh with GetMesh()->SetRelativeLocation() and FMath::VInterpTo somehow?

That’s because the mesh has already some offset in relation to the capsule. I should have been more clear in relation to the example I provided: it will go upwards until the mesh is 1000 units away from the parent component.

To really move x units, use for example AddLocalOffset instead.

Yeah I see, that definitely makes sense but for some reason AddLocalOffset sent my mesh somewhere completely outside of the world boundaries - but I’m fine with the previous solution as long as it’s working as expected. Thanks!