36 lines
867 B
C++
36 lines
867 B
C++
// CameraFollowActor.h
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "CameraFollowActor.generated.h"
|
|
|
|
UCLASS()
|
|
class YOURPROJECT_API ACameraFollowActor : public AActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this actor's properties
|
|
ACameraFollowActor();
|
|
|
|
protected:
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
// The target actor that the camera will follow
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
|
|
AActor* TargetActor;
|
|
|
|
// The offset from the target actor
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
|
|
FVector CameraOffset;
|
|
|
|
private:
|
|
UPROPERTY(VisibleAnywhere)
|
|
UCameraComponent* CameraComponent;
|
|
}; |