As I am new to Unreal Engine scripting I’m finding it extremely difficult to set a custom follow camera that matches a specific camera logic.
I am trying to do this entirely in C++ but I would welcome Blueprint suggestions aswell.
What I am trying to achieve:
- The character is controlled by WASD (or joystick) and the camera follows the character at a distance.
- The distance increases based on the speed of the character (the faster the character runs, the more distance between it and the camera)
- The rotation of the camera(Yaw only) is controlled by the rotation of the Character (when the character turns, the camera swings to the opposing side in order to go at the character’s back again)
- The swing of the camera is LErp-ed based on the angle between the camera look at vector and the character face to vector.
Setup is 3th person view (created with the new project wizard).
I got most of the functionality from the created source.
Character orientation is not restrained to the controller
bUseControllerRotationPitch = false; bUseControllerRotationYaw = false; bUseControllerRotationRoll = false;
Character is restrained to input
CharacterMovement->bOrientRotationToMovement = true;
When I set the CameraBoon to NOT use controller view rotation the camera swings in the needed direction
CameraBoom->bUseControllerViewRotation = false;
So far so good, but I could not find a way to make the camera ALWAYS look at the character no mater what it’s position is.
Could someone assist in this matter?
Thank you in advance.