Compare commits
No commits in common. "a5cfef827b07403d076dd0e340d7e16b0d2239be" and "35dfb9f67cef65786b1287bf63fef7107ad55212" have entirely different histories.
a5cfef827b
...
35dfb9f67c
|
@ -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)
BIN
Content/Levels/Level.umap (Stored with Git LFS)
Binary file not shown.
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
};
|
|
|
@ -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
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue