The move tool you see circeled can move anywhere and the players body and camera wont follow. I have never had this issue before, no idea why now?
cpp file
// Fill out your copyright notice in the Description page of Project Settings.
#include "PlayerPawn.h"
#include "Components/CapsuleComponent.h"
#include "Components/SkeletalMeshComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"
#include "Components/SceneComponent.h"
// Sets default values
APlayerPawn::APlayerPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Root = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
RootComponent = Root;
SkeletalMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Skeletal Mesh"));
CapsuleComponent = CreateDefaultSubobject<UCapsuleComponent>(TEXT("Capsule"));
CapsuleComponent->SetupAttachment(SkeletalMesh);
SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("Spring Arm"));
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->SetupAttachment(SpringArm);
}
// Called when the game starts or when spawned
void APlayerPawn::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void APlayerPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void APlayerPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
}
.h file
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "PlayerPawn.generated.h"
UCLASS()
class SURVIVALGAME_API APlayerPawn : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
APlayerPawn();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
private:
UPROPERTY(EditAnywhere)
class UCapsuleComponent* CapsuleComponent;
UPROPERTY(EditAnywhere)
class USkeletalMeshComponent* SkeletalMesh;
UPROPERTY(VisibleAnywhere)
class USpringArmComponent* SpringArm;
UPROPERTY(VisibleAnywhere)
class UCameraComponent* Camera;
UPROPERTY(VisibleAnywhere)
class USceneComponent* Root;
};
Does anyone know why this is and how to fix it? I tested the same components in BP instead of C++ and it worked fine.