Detatch Camera from Player

This commit is contained in:
baz 2025-03-17 21:38:13 +00:00
parent 4c584372cc
commit 3477676851
4 changed files with 4 additions and 31 deletions

BIN
Content/Levels/Level.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Player/BP_PlayerCharacter.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -10,29 +10,10 @@
#include "GoldComponent.h"
#include "InputMappingContext.h"
#include "WeaponInventoryComponent.h"
#include "Camera/CameraComponent.h"
#include "Components/WidgetComponent.h"
#include "GameFramework/SpringArmComponent.h"
APlayerCharacter::APlayerCharacter()
{
// Create Camera Boom
CameraSpringArmComponent = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraSpringArmComponent"));
CameraSpringArmComponent->SetupAttachment(RootComponent);
CameraSpringArmComponent->bDoCollisionTest = true;
CameraSpringArmComponent->bUsePawnControlRotation = false;
CameraSpringArmComponent->TargetArmLength = 1000;
CameraSpringArmComponent->bEnableCameraLag = false;
CameraSpringArmComponent->SocketOffset = {0.0f, 0.0f, 0.0f};
CameraSpringArmComponent->SetRelativeRotation({-90.0, 0.0f, 0.0f});
// Create Camera
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera Component"));
CameraComponent->SetupAttachment(CameraSpringArmComponent, USpringArmComponent::SocketName);
CameraComponent->bUsePawnControlRotation = false;
CameraComponent->SetProjectionMode(ECameraProjectionMode::Type::Orthographic);
CameraComponent->SetOrthoWidth(4000.0f);
// Create EXP Component
EXPComponent = CreateDefaultSubobject<UEXPComponent>(TEXT("EXP Component"));

View File

@ -11,8 +11,6 @@ class UWidgetComponent;
class UWeaponInventoryComponent;
class UGoldComponent;
class UEXPComponent;
class UCameraComponent;
class USpringArmComponent;
class UInputMappingContext;
class UInputAction;
@ -25,12 +23,6 @@ class VAMPIRES_API APlayerCharacter : public AVampireCharacter
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
USpringArmComponent* CameraSpringArmComponent = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UCameraComponent* CameraComponent = nullptr;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UEXPComponent* EXPComponent;