Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do you set the PlayerCameraManager on a PlayerController?

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:


 class SWCameraManager;
 class UCapsuleComponent;
 class MYPROJECT_API ASWPlayerController : public APlayerController
     UPROPERTY(VisibleAnywhere, Category = "Camera")
     SWPlayerCameraManager * CameraManager; 


     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?

Product Version: UE 4.18
more ▼

asked Jan 22 '18 at 02:58 PM in C++ Programming

avatar image

Glenn Holland
8 1 5 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey there, to set the Player Camera Manager i do this:

 ABasePlayerController::ABasePlayerController(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
     PlayerCameraManagerClass = ABasePlayerCameraManager::StaticClass();
more ▼

answered Jan 22 '18 at 03:08 PM

avatar image

6k 161 129 304

avatar image Glenn Holland Jan 22 '18 at 03:33 PM

Thank-you so much. I didn't realise that there was StaticClass() method.

On a separate note, while I'm learning..... your constructor is taking an argument that looks like it is a reference to a generic "ObjectInitializer". What is the purpose of that?

avatar image xlar8or Jan 22 '18 at 03:36 PM

You don't need it anymore, this is the old way of doing constructors in UE 4.

avatar image Glenn Holland Jan 22 '18 at 03:37 PM

Thanks for the clarification

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question