I’m used to blueprint but even with that I have never been 100% clear about my understanding of how character classes and controllers and cameras all interact.
So recently I wanted to delve into C++ through following this guide that walks you through a method of achieving a True First Person System mainly in C++: http://www.froyok.fr/blog/2018-06-tr…nreal-engine-4
However I’ve hit many problems along the way and tried to get around the problems by scouring the internet for what I think are the answers whilst actually learning about what I’m doing. So I’ve made this thread to hopefully have my character, player control etc questions answered.
What do I need to know about the :SetupInputComponent() function? It’s in the example projects and seems to handle the input. Simple enough. But in the example it’s on the character class (and in the guide I linked above) but online I’ve read input should be handled in the controller. What are general rules about this? In my so far failed attempt to follow the guide I ended up putting the SetupInputComponent() in the controller anyway as the guide had a line PlayerInputComponent->BindAxis(“CameraRotationHorizontal”, EPC, &AExedrePlayerController::InputCameraAddYaw); Where I assume the EPC was the name for &AExedrePlayerController to be accsed from the character class in this case. I couldn’t replicate this myself so put the input function in the controller class with the InputCameraAddYaw function so using **this, **worked instead.
I’m very unsure of how C++ classes and blueprints work in this whole thing. Specifically in the component department. Basically I am working off the blueprinted third person character but making it’s parent my own custom character class. This might be silly because shouldn’t this mean the camera, mesh, boom arm in the blueprint third person guy and the camera, mesh, boom arm spawned in the C++ of the custom character class should interfere with each other. However I don’t see this in playing the game. In fact, messing with the boom arms length in the code effects the length of it on the third person blueprint character so I must be way off with my understanding here.
How is camera rotation handled. From what I see: The camera is spawned in the character class and not touched there other than to attach it to the boom arm. But then there’s the input function for example with the mouse used to call the function AddControllerYawInput all the way on the APawn. Which somehow finds the camera and rotates it? What’s happening here? To further confuse me, through following the guide linked above **(I’m assuming I’m right in saying the way the true first person guide works is that the mouse doesn’t move the camera at all but instead gets rotation values that make a skeletal meshes head move and the camera is simply stuck to the head bone<<Simplified anyway) **so I’ve removed the input calls to the APawn for pitch and yaw and replaced them with the functions from the guide. Admittedly I’m stuck here for coding issues that aren’t related to the camera but the crazy thing is; the camera still is rotated by the mouse. I can’t understand why other than the updaterotation() function doing this. But that function is needed in the guide and seems to be called all the time and important in the Aplayercontroller. My confusion is how things like Apawn and Aplayerotation can easily control the camera, seemingly in the ue4 uneditable codes, and how that will conflict with custom classes.
And I’ll leave it here as this is long. Hope my questions make sense. I’m very inexperienced with this stuff.