I have looked at loads of information about how camera systems are set up in UE4 and have settled on the camera system I want in my game.
I want to be able to switch pawns so I am going to have a custom PlayerController that possesses the pawns. I want a third person camera over that pawn which has some movement constraints. To get started I created a custom PlayerControllerClass and a custom PlayerCameraManager.
How do I set the player controller to use the custom PlayerCameraManager?
I tried:
.h
//ForwardDeclaration
class SWCameraManager;
class UCapsuleComponent;
UCLASS()
class MYPROJECT_API ASWPlayerController : public APlayerController
{
GENERATED_BODY()
protected:
//CameraManager
UPROPERTY(VisibleAnywhere, Category = "Camera")
SWPlayerCameraManager * CameraManager;
};
.cpp
ASWPlayerCameraManager::ASWPlayerCameraManager()
{
PlayerCameraManagerClass = CameraManager;
};
This is throwing an error that SWPlayerClass is not of type UCLASS(), which I kind of expected. I have seen in the docs the PlayerController exposes both PlayerCameraManager and PlayerCameraManagerClass. I am under the impression from hearsay and conjecture that I need to set the latter by casting my custom SWPlayerCameraManager as a PlayerCameraManager, but I have no basis to back that up.
Do I do this in the CPP file without declaring a class varible? Can I just set PlayerCameraManagerClass = Cast<SWPlayerControllerManager>();
or is there a Setter method I have missed?
I am rather confused by this.
TL;DR: What code goes where when assigning a custom PlayerCameraManager to a custom PlayerController?