I’m trying to take control of the player and manually move them in a straight line to a predetermined point with interpolation.
The way I’m trying to do this is with a CustomMovementComponent attached to the FirstPersonPlayer, which has a custom movement mode. Everything related to the component and the mode seems to be working, at least at a high level.
I added a TickComponent method to my movement component and added new movement code there.
void UGrappleMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
if (MovementMode == MOVE_Custom && CustomMovementMode == MOVE_Grapple)
{
ACharacter* character = GetCharacterOwner();
FVector test_direction = FVector(1, 0, 0);
character->AddMovementInput(test_direction, 4.0, true);
}
else
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}
}
My expectation is that when the movement mode changes, the user will lose control of the player and the player will move (in this case, on the X axis). So far, the player isn’t going anywhere. Not sure what, if anything, I’m doing wrong here. Is there another, better way to move a character in code and without using the AI navmesh?