Player Camera Look

I seem to be stumbling.

// Fill out your copyright notice in the Description page of Project Settings.

#include "ROT.h"
#include "DefaultCharacter.h"


// Sets default values
ADefaultCharacter::ADefaultCharacter()
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void ADefaultCharacter::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void ADefaultCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}

// Called to bind functionality to input
void ADefaultCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
}

void ADefaultCharacter::ControllerMoveForward(float AxisValue)
{
	if (AxisValue != 0)
	{
		AddMovementInput(FRotationMatrix(GetControlRotation()).GetScaledAxis(EAxis::X), AxisValue * Speed);
	}
}

void ADefaultCharacter::ControllerMoveRight(float AxisValue)
{
	if (AxisValue != 0)
	{ 
		AddMovementInput(FRotationMatrix(GetControlRotation()).GetScaledAxis(EAxis::Y), AxisValue * Speed);
	}
}

void ADefaultCharacter::ControllerTurn(float AxisValue)
{
	AddControllerYawInput(AxisValue * TurnSpeed);
}

void ADefaultCharacter::ControllerLook(float AxisValue)
{
}

This is the cpp file that handles movement. I’ll keep this short. Attaching the camera to the root causes the player to move off without the camera, but can look around. Attaching to the capsule makes the player able to move with the camera, but rotates without. Its a never-ending cycle. Anyone know how to solve?

Did you want 1stperson or 3rdperson look? I think the error is not in code but the way the player actor is set up.

Hey!

I am “Aiming” (lol) towards 1st person.

I can send the cpp and h files utilized but there is no further setup in the blueprint.

Attaching to the capsule makes the
player able to move with the camera,
but rotates without.

If your camera is not attached to a spring arm, attach the camera to the capsule component and look at the camera’s details in your character’s blueprint.

Assuming you are using APlayerController (ie AddControllerYawInput, and other for Pitch/roll), make sure the Camera Settings are set to ‘inherit pawn control rotation’.

132510-camerasettings.png

You may also try:

MyCharacterCameraComponent->bAbsoluteRotation = false;

According to the [API documentation][2]

bAbsoluteRotation - If RelativeRotation should be considered relative to the world, rather than the parent

Sorry for the delayed response but thank you!!!