I have a class than inherits from a APawn.
Inside the BeginPlay method I call
GetActorLocation() and it returns its location (-820, 0, 500).
Then, when the user press a key, in a delegate function to an Action defined in the project settings, I call again
GetActorLocation() and it returns (0, 0, 0).
By the way, the
BeginPlay method and the delegate function (
AMyPawn::ZoomIn) are both defined in the same class.
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
InputComponent->BindAction("ZoomIn", IE_Pressed, this, &AMyPawn::ZoomIn);
I don’t know why it happens, but it can be because the
AMyPawn::ZoomIn is called as a delegate.
GetActorLocation() return (0, 0, 0)?