Hi all,
I don’t understand how and when the character movement is applied.
Using the TopDown C++ example, here is the code snippet
void ATopDownPlayerController::PlayerTick(float DeltaTime)
{
FVector v1 = GetPawn()->GetActorLocation();
Super::PlayerTick(DeltaTime);
FVector v2 = GetPawn()->GetActorLocation();
}
Question 1)
From what I understand PlayerTick is responsible for character movement so I wonder why v1 and v2 are always equal? I would expect them to be different if character moves.
Question 2)
Take a look at this new character
void ATopDownPlayerNewSpeedController::PlayerTick(float DeltaTime)
{
FVector v1 = GetPawn()->GetActorLocation();
Super::PlayerTick(DeltaTime * 100);
FVector v2 = GetPawn()->GetActorLocation();
}
Why ATopDownPlayer and ATopDownPlayerNewSpeed have the same speed? I would expect the latter to move 100 times faster.
Question 3)
I need to calculate player position at time T so I am looking for a function like this pseudo-code:
FVector v1 = GetActorLocation();
AddMovementInput(vector, Value);
ApplyMovement(my_custom_delta_time);
FVector v2 = GetActorLocation();
having with v2 the new actor position
Do you have any tips on “ApplyMovement(float)” function could be implemented?
Thank you very much!
Gianluca