Hi!
I’m trying to get a reference for my default pawn inside my custom player controller class:
include “MyCameraController.h”
include “MyGameModeBase.h”
include “CameraPawn.h”void AMyCameraController::SetupInputComponent()
{
Super::SetupInputComponent();// Input controller
InputComponent->BindAction(“ZoomIn”, IE_Pressed, this, &AMyCameraController::ZoomIn);
InputComponent->BindAction(“ZoomOut”, IE_Pressed, this, &AMyCameraController::ZoomOut);
InputComponent->BindAxis(“MoveSideways”, this, &AMyCameraController::MoveSideways);
}void AMyCameraController::ZoomIn()
{
AMyGameModeBase* MyGameMode = GetWorld()->GetAuthGameMode();
ACameraPawn* MyPawn = myGameMode->DefaultPawnClass.GetDefaultObject();
}void AMyCameraController::ZoomOut()
{
}void AMyCameraController::MoveSideways(float AxisValue)
{
}
But I don’t know how to do it because the above code doesn’t compile and I don’t know if there is an Unreal’s function to get it.
Thanks.