How can I set this up in c++?

Like the

title said i want to know how to set this blueprint in C++.

Correct math i think xD
void ACharacter::ReceiveBeginPlay()
{
FRotator Adjustment = FollowCamera->GetComponentRotation();

Adjustment.Pitch += 10;

FRotator MakeRot(Adjustment.Pitch, Adjustment.Yaw, Adjustment.Roll);

FVector GetForwardVector = MakeRot.Vector();

float Distance = 420;

FVector MultiplyVectorFloat(GetForwardVector * Distance);

FVector LocationFinal = FollowCamera->GetComponentLocation();

FVector Add_VectorVector(LocationFinal + MultiplyVectorFloat);

FVector NewLocation = Add_VectorVector;

Hello and this is the completed BP but im trying to set it up in C++ i need to update the math i think i set them up. In essence the purpose of this is to offset the camera in pitch.

Yeah, you know when you open up the Third person template the camera its attach or “focus” on the center of the character by doing this i can get it the head, its just to aim at stuff easier. ^^

haha sorry Blueprint scripting is like another language to me, I’ve only used C++ and simply attaching code to a bp and vis versa T_T
You’re trying to offset the camera from the player? Is the camera attached to something ?

Sorry I accidently deleted my comment so I don’t know if you commented back(kids are diving me crazy atm!). I posted that i didn’t know anything about bp scripting so I don’t know what’s going on when i look at it really.
Is the camera attached to the object you are trying to offset it to?
Or is the camera if a different bp/class?
Did you create a spring arm?

This is what you do to create the camera in the player class:

header:

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
    	class UCameraComponent* SideViewCameraComponent;
    
    	/** Camera boom positioning the camera beside the character */
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
    	class USpringArmComponent* CameraBoom;

CPP:

 // Don't rotate when the controller rotates.
    	bUseControllerRotationPitch = false;
    	bUseControllerRotationYaw = false;
    	bUseControllerRotationRoll = false;
    
    	// Create a camera boom attached to the root (capsule)
    	CameraBoom = ObjectInitializer.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom"));
    	CameraBoom->AttachTo(RootComponent);
    	CameraBoom->bAbsoluteRotation = true; // Rotation of the character should not affect rotation of boom
    	CameraBoom->TargetArmLength = 750.f;
    	CameraBoom->SocketOffset = FVector(0.f,0.f,75.f);
    	CameraBoom->RelativeRotation = FRotator(0.f,180.f,0.f);
    
    	// Create a camera and attach to boom
    	SideViewCameraComponent = ObjectInitializer.CreateDefaultSubobject<UCameraComponent>(this, TEXT("SideViewCamera"));
    	SideViewCameraComponent->AttachTo(CameraBoom, USpringArmComponent::SocketName);
    	SideViewCameraComponent->bUsePawnControlRotation = false; // We don't want the controller rotating the camera

yes im trying to do Both ^^

but what happens to the player camera already created?

I tried it with both the follow camera and camera boom, both sent the object far away and the character, it also does not attach well this are the lines that im working with.

AACharacter::Target->SetWorldLocation(NewLocation, false);

and

AACharacter::Target->AttachTo(CameraBoom, InSocketName = NAME_None, EAttachLocation::Type(EAttachLocation::KeepWorldPosition), true);

Yo have top create a spring arm and camera component, attach the spring arm it to the player/object, then attach the camera object/component to the springarm.

After that, you can change the location./offset of the spring arm(or camera component) to the objects it attached to for example:

CameraBoom->relativerotation.Pitch = 50.0f;

OR

CameraCompoent->relativerotation.Pitch = 50.0f;

What I wrote is just an example. Did you create a spring arm to your camera?

Are you working with a blueprint? Is the AACharacter part of the same class as the CameraComponent and Cameraboom(I’m assuming so but just in case)

yes is a TSubobject of follow camera

To get the player camera from another class, you use

FVector CameraLocation = GEngine->GetFirstLocalPlayerController(GetWorld())->PlayerCameraManager->GetCameraLocation();

FRotator CameraRotation = GEngine->GetFirstLocalPlayerController(GetWorld())->PlayerCameraManager->GetCameraRotation();

To “offset” it, you add a rotation amount:
myComponent->RelativeRotation.Pitch = CameraRotation.Pitch + 90.0f;

tyvm for the help

did you get it to work? :o

yeah but now im stuck in some other part but thats for another day ^^