Skip to content

Commit

Permalink
Add camera bounds visual (#11)
Browse files Browse the repository at this point in the history
* Fix camera bounds logic, wasn't calling the function :(

* Add a CameraBoundsVolume class

* Create drag and drop visual camera bounds

* Use a thinner map border

* Give up on trying to submit readme
  • Loading branch information
HeyZoos committed Jun 4, 2022
1 parent 9c11035 commit acd329b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
1 change: 0 additions & 1 deletion Config/FilterPlugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
; /README.txt
; /Extras/...
; /Binaries/ThirdParty/*.dll
/README.md
3 changes: 3 additions & 0 deletions Content/BP_CameraBoundsVolume.uasset
Git LFS file not shown
3 changes: 3 additions & 0 deletions Content/Materials/M_CameraBounds.uasset
Git LFS file not shown
3 changes: 3 additions & 0 deletions Content/Materials/T_SolidBorder.uasset
Git LFS file not shown
8 changes: 3 additions & 5 deletions OpenRTSCamera.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "0.11.2",
"VersionName": "0.12.0",
"FriendlyName": "OpenRTSCamera",
"Description": "An Unreal Engine 5 open-source RTS/MOBA camera implementation that aims to be fully featured, customizable and dependable",
"Category": "Gameplay",
Expand All @@ -11,9 +11,7 @@
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/94e9872ad3754e798b6ec53f4494f5de",
"SupportURL": "https://github.com/HeyZoos/OpenRTSCamera/issues",
"CanContainContent": true,
"IsBetaVersion": true,
"IsExperimentalVersion": false,
"EngineVersion": "5.0.1",
"EngineVersion": "5.0.0",
"Installed": false,
"Modules": [
{
Expand All @@ -31,4 +29,4 @@
"Enabled": true
}
]
}
}
7 changes: 4 additions & 3 deletions Source/OpenRTSCamera/Private/RTSCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
URTSCamera::URTSCamera()
{
PrimaryComponentTick.bCanEverTick = true;
this->CameraBlockingVolumeTag = "@CameraBounds";
this->CameraBlockingVolumeTag = FName("OpenRTSCamera#CameraBounds");
this->EdgeScrollSpeed = 50;
this->DistanceFromEdgeThreshold = 0.1f;
this->EnableCameraLag = true;
Expand Down Expand Up @@ -80,6 +80,7 @@ void URTSCamera::TickComponent(
this->ConditionallyKeepCameraAtDesiredZoomAboveGround();
this->SmoothTargetArmLengthToDesiredZoom();
this->FollowTargetIfSet();
this->ConditionallyApplyCameraBounds();
}

void URTSCamera::FollowTarget(AActor* Target)
Expand Down Expand Up @@ -203,14 +204,14 @@ void URTSCamera::TryToFindBoundaryVolumeReference()
TArray<AActor*> BlockingVolumes;
UGameplayStatics::GetAllActorsOfClassWithTag(
this->GetWorld(),
ABlockingVolume::StaticClass(),
AActor::StaticClass(),
this->CameraBlockingVolumeTag,
BlockingVolumes
);

if (BlockingVolumes.Num() > 0)
{
this->BoundaryVolume = Cast<ABlockingVolume>(BlockingVolumes[0]);
this->BoundaryVolume = BlockingVolumes[0];
}
}

Expand Down
14 changes: 6 additions & 8 deletions Source/OpenRTSCamera/Public/RTSCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "InputMappingContext.h"
#include "Camera/CameraComponent.h"
#include "Components/ActorComponent.h"
#include "Engine/BlockingVolume.h"
#include "GameFramework/SpringArmComponent.h"
#include "RTSCamera.generated.h"

Expand All @@ -31,9 +30,6 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
UFUNCTION(BlueprintCallable, Category = "RTSCamera")
void UnFollowTarget();

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera")
FName CameraBlockingVolumeTag;

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera - Zoom Settings")
float MinimumZoomLength;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera - Zoom Settings")
Expand All @@ -58,7 +54,7 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
bool EnableCameraLag;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera")
bool EnableCameraRotationLag;

UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera - Dynamic Camera Height Settings")
bool EnableDynamicCameraHeight;
UPROPERTY(
Expand Down Expand Up @@ -124,7 +120,7 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
UPROPERTY()
APlayerController* PlayerController;
UPROPERTY()
ABlockingVolume* BoundaryVolume;
AActor* BoundaryVolume;

float DesiredZoomLength;

Expand All @@ -133,7 +129,7 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
void ConfigureSpringArm();
void TryToFindBoundaryVolumeReference();
void ConditionallyEnableEdgeScrolling() const;
void CheckForEnhancedInputComponent() const;
void CheckForEnhancedInputComponent() const;
void BindInputMappingContext() const;
void BindInputActions();

Expand All @@ -149,7 +145,9 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
void ConditionallyApplyCameraBounds() const;

UPROPERTY()
float DeltaSeconds;
FName CameraBlockingVolumeTag;
UPROPERTY()
AActor* CameraFollowTarget;
UPROPERTY()
float DeltaSeconds;
};

0 comments on commit acd329b

Please sign in to comment.