Oakfolks Gold_1.14
Oakfolks coop game
Loading...
Searching...
No Matches
MainCamera.h
1#pragma once
2
3#include "CoreMinimal.h"
4#include "GameFramework/Actor.h"
5#include <Camera/CameraComponent.h>
6#include "CineCameraComponent.h"
7#include <GameFramework/SpringArmComponent.h>
8#include <Components/SphereComponent.h>
9#include "GameFramework/Character.h"
10#include "Components/ExponentialHeightFogComponent.h"
11#include "MainCamera.generated.h"
12
14
19UCLASS()
20class BCR_API AMainCamera : public AActor
21{
22 GENERATED_BODY()
23
24public:
25
28 virtual void BeginPlay() override;
29 virtual void Tick(float DeltaTime) override;
30
33 UFUNCTION(BlueprintCallable)
34 void SetPlayers(ACharacter* Player1, ACharacter* Player2);
35
38 FORCEINLINE USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
39 FORCEINLINE UCameraComponent* GetFollowCamera() const { return FollowCamera; }
40
43 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Debug")
44 bool DebugLocation = false;
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Debug")
46 bool DebugVariables = false;
47
50 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Translation")
51 bool EnableVerticalMovement = true;
52 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Translation")
53 float VerticalOffset = 0.f;
54
57 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Distance", meta = (UIMin = 0.f))
58 float MinimumArmLength = 4000.f;
59 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Distance", meta = (UIMin = 0.f))
60 float MaximumArmLength = 16000.f;
61 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Distance", meta = (UIMin = 0.f))
62 float DepthBuffer = 400.f;
63 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Distance", meta = (UIMin = 0.f))
64 float HorizontalBuffer = 200.f;
65
68 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Angle")
69 bool UseAngleChange = true;
70 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Angle", meta = (UIMin = 0.f))
71 float MinAngleReachedAtArmLength = 4000.f;
72 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Angle", meta = (UIMin = 0.f))
73 float MaxAngleReachedAtArmLength = 20000.f;
74 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Angle", meta = (UIMin = 0.f, UIMax = 90.f))
75 float MinArmAngle = 10.f;
76 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Angle", meta = (UIMin = 0.f, UIMax = 90.f))
77 float MaxArmAngle = 20.f;
78 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Angle")
79 float EasingAngleExp = 1.f;
80 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Tilt shift")
81 float MinFStop = 0.2f;
82
85 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Tilt shift")
86 float MaxFStop = 2.f;
87 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Tilt shift")
88 float MaxBlurAtDistance = 100.f;
89 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Tilt shift")
90 float MinBlurAtDistance = 1500;
91 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Tilt shift")
92 float BlurMultiplier = 1.f;
93
96 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Parameters|Fog")
97 float FogDistanceToPlayer = 1000.f;
98
99private:
100
103 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
104 USceneComponent* DefaultRootComponent;
105 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
106 USpringArmComponent* CameraBoom;
107 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
108 UCineCameraComponent* FollowCamera;
109 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
110 USphereComponent* DebugSphere;
111
114 TArray<ACharacter*> Players;
115
118 float MaxPlayerHorizontalDistance = MAX_FLT;
119 float MaxPlayerDepthDistance = MAX_FLT;
120
123 UExponentialHeightFogComponent* FogComp = nullptr;
124
127 void InitParam();
128 void UpdatePosition();
129 void UpdateArmLenght();
130 void UpdateArmAngle();
131 void UpdateFog(float DepthPlayerDistance);
132 void UpdateBlur(float DepthPlayerDistance);
133 void ConstrainPlayerPositions();
134
137 FVector2D Get2DVect(FVector vect3d);
138 float GetAlpha(float value, float min, float max);
139 float GetValue(float alpha, float min, float max);
140};
Dynamic cooperative camera system for two-player gameplay.
Definition MainCamera.h:21
FORCEINLINE USpringArmComponent * GetCameraBoom() const
Definition MainCamera.h:38