Compare commits

..

No commits in common. "a5cfef827b07403d076dd0e340d7e16b0d2239be" and "35dfb9f67cef65786b1287bf63fef7107ad55212" have entirely different histories.

6 changed files with 3 additions and 75 deletions

View File

@ -1,10 +1,9 @@
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/Levels/Level.Level GameDefaultMap=/Engine/Maps/Templates/OpenWorld
GameInstanceClass=/Game/Gamemodes/BP_TankGameinstance.BP_TankGameinstance_C GameInstanceClass=/Game/Gamemodes/BP_TankGameinstance.BP_TankGameinstance_C
GlobalDefaultGameMode=/Game/Gamemodes/BP_TankGamemode.BP_TankGamemode_C GlobalDefaultGameMode=/Game/Gamemodes/BP_TankGamemode.BP_TankGamemode_C
EditorStartupMap=/Game/Levels/Level.Level
[/Script/WindowsTargetPlatform.WindowsTargetSettings] [/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12 DefaultGraphicsRHI=DefaultGraphicsRHI_DX12

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

Binary file not shown.

View File

@ -1,32 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "CameraVolume.h"
#include "TankPlayerCharacter.h"
ACameraVolume::ACameraVolume()
{
ArrowComponent = CreateDefaultSubobject<UArrowComponent>(TEXT("Arrow Component"));
ArrowComponent->SetupAttachment(RootComponent);
DebugCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("Debug Camera"));
DebugCamera->SetupAttachment(ArrowComponent);
DebugCamera->SetActive(false);
}
void ACameraVolume::BeginPlay()
{
Super::BeginPlay();
this->OnActorBeginOverlap.AddDynamic(this, &ACameraVolume::OnBeginOverlap);
}
void ACameraVolume::OnBeginOverlap(AActor* OverlappedActor, AActor* OtherActor)
{
if (ATankPlayerCharacter* PlayerCharacter = Cast<ATankPlayerCharacter>(OtherActor))
{
FTransform transform = PlayerCharacter->CameraComponent->GetComponentTransform();
transform.SetLocation(ArrowComponent->GetComponentTransform().GetLocation());
transform.SetRotation(ArrowComponent->GetComponentTransform().GetRotation());
PlayerCharacter->CameraComponent->SetWorldTransform(transform);
}
}

View File

@ -1,34 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Camera/CameraComponent.h"
#include "Components/ArrowComponent.h"
#include "Engine/TriggerVolume.h"
#include "CameraVolume.generated.h"
/**
*
*/
UCLASS(Blueprintable)
class TANK_API ACameraVolume : public ATriggerVolume
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UArrowComponent* ArrowComponent;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UCameraComponent* DebugCamera;
ACameraVolume();
protected:
virtual void BeginPlay() override;
private:
UFUNCTION()
void OnBeginOverlap(AActor* OverlappedActor, AActor* OtherActor);
};

View File

@ -14,7 +14,6 @@ ATankPlayerCharacter::ATankPlayerCharacter()
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it. // 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; PrimaryActorTick.bCanEverTick = true;
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera Component"));
} }
// Called when the game starts or when spawned // Called when the game starts or when spawned

View File

@ -3,7 +3,6 @@
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "TankPlayerCharacter.generated.h" #include "TankPlayerCharacter.generated.h"
@ -27,9 +26,6 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UInputAction* YawAction; UInputAction* YawAction;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UCameraComponent* CameraComponent;
public: public:
// Sets default values for this character's properties // Sets default values for this character's properties
ATankPlayerCharacter(); ATankPlayerCharacter();