More refactors, remove universal camera, tweak build script

This commit is contained in:
2026-07-17 23:49:40 +02:00
parent 5d6377b082
commit fa0363bd1d
95 changed files with 287 additions and 4394 deletions

View File

@@ -1,18 +1,26 @@
@echo off @echo off
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
echo =================================== echo ===================================
echo Eleri - Build, Upload and Notify echo Eleri - Build, Upload and Notify
echo =================================== echo ===================================
:: ---- CONFIG edit these ---- :: ---- CONFIG - edit these ----
set UE_VERSION=5.8 set UE_VERSION=5.8
set PROJECT_PATH=C:\Projects\ProjectEleri\ProjectEleri.uproject set PROJECT_PATH=C:\Projects\ProjectEleri\ProjectEleri.uproject
set PROJECT_NAME=Eleri set PROJECT_NAME=Eleri
set OUTPUT_DIR=C:\Projects\ProjectEleri\BUILD\Debug set OUTPUT_DIR=C:\Projects\ProjectEleri\BUILD
set MAX_BUILDS=10 set MAX_BUILDS=10
set UAT_PATH=C:\Program Files\Epic Games\UE_%UE_VERSION%\Engine\Build\BatchFiles\RunUAT.bat set UAT_PATH=C:\Program Files\Epic Games\UE_%UE_VERSION%\Engine\Build\BatchFiles\RunUAT.bat
:: ---- STEAM CONFIG - edit these ----
set STEAMCMD_PATH=C:\Users\adnan\Downloads\steamworks_sdk_161\sdk\tools\ContentBuilder\builder\steamcmd.exe
set STEAM_USERNAME=adodev
set STEAM_APP_ID=3528720
:: Only Shipping gets uploaded to Steam - DebugGame builds are local-only
set STEAM_DEPOT_SHIPPING=3528721
:: Folder where generated Steam VDF scripts will be written (temp working files, safe to keep in OUTPUT_DIR)
set STEAM_VDF_DIR=%OUTPUT_DIR%\steam_vdf
:: ---- ARGUMENTS ---- :: ---- ARGUMENTS ----
set BUILD_VERSION=%1 set BUILD_VERSION=%1
set CHANGELOG=%~2 set CHANGELOG=%~2
@@ -25,33 +33,68 @@ if "%CHANGELOG%"=="" set /p CHANGELOG="Changelog / notes (optional, press Enter
echo. echo.
echo Which steps would you like to run? echo Which steps would you like to run?
echo 1 - Build only echo 1 - Build only
echo 2 - Build + Zip echo 2 - Build + Upload to Steam
echo. echo.
set /p RUN_STEPS="Enter choice (1-2): " set /p RUN_STEPS="Enter choice (1-2): "
if "%RUN_STEPS%"=="" set RUN_STEPS=1
if "%RUN_STEPS%" LSS "1" set RUN_STEPS=1
if "%RUN_STEPS%" GTR "2" set RUN_STEPS=1
if "%RUN_STEPS%"=="" set RUN_STEPS=2 :: ---- CONFIG SELECTION ----
if "%RUN_STEPS%" LSS "1" set RUN_STEPS=2 echo.
if "%RUN_STEPS%" GTR "4" set RUN_STEPS=2 echo Which configuration(s) would you like to build?
echo 1 - DebugGame
echo 2 - Shipping
echo 3 - Both
echo.
set /p CFG_CHOICE="Enter choice (1-3): "
if "%CFG_CHOICE%"=="" set CFG_CHOICE=1
if "%CFG_CHOICE%"=="1" set CONFIGS=DebugGame
if "%CFG_CHOICE%"=="2" set CONFIGS=Shipping
if "%CFG_CHOICE%"=="3" set CONFIGS=DebugGame Shipping
if not defined CONFIGS set CONFIGS=DebugGame
echo. echo.
echo Running steps 1 through %RUN_STEPS%... echo Running steps 1 through %RUN_STEPS% for configuration(s): %CONFIGS%
echo.
set BUILD_TYPE=debug
set DEST_FILENAME=%PROJECT_NAME%_%BUILD_VERSION%.zip
set BUILD_OUTPUT=%OUTPUT_DIR%\%BUILD_VERSION%%
:: ==================================== :: ====================================
:: STEP 1 — BUILD :: MAIN LOOP - one pass per selected config
:: ==================================== :: ====================================
echo. for %%C in (%CONFIGS%) do (
echo [1/2] Building %PROJECT_NAME% in DebugGame mode... call :build_one_config %%C
echo. if !errorlevel! neq 0 (
echo ERROR: Pipeline failed for config %%C.
pause
exit /b 1
)
)
echo.
echo ===================================
echo All done! (ran steps 1-%RUN_STEPS% for: %CONFIGS%)
echo ===================================
pause
exit /b 0
:: ====================================
:: SUBROUTINE - build/upload a single config
:: %1 = config name (DebugGame or Shipping)
:: ====================================
:build_one_config
set THIS_CONFIG=%~1
set BUILD_OUTPUT=%OUTPUT_DIR%\%BUILD_VERSION%\%THIS_CONFIG%
:: ---- STEP 1: BUILD ----
echo.
echo [1/2] Building %PROJECT_NAME% in %THIS_CONFIG% mode...
echo.
call "%UAT_PATH%" BuildCookRun ^ call "%UAT_PATH%" BuildCookRun ^
-project="%PROJECT_PATH%" ^ -project="%PROJECT_PATH%" ^
-noP4 ^ -noP4 ^
-platform=Win64 ^ -platform=Win64 ^
-clientconfig=DebugGame ^ -clientconfig=%THIS_CONFIG% ^
-cook ^ -cook ^
-build ^ -build ^
-stage ^ -stage ^
@@ -60,45 +103,75 @@ call "%UAT_PATH%" BuildCookRun ^
-archivedirectory="%BUILD_OUTPUT%" ^ -archivedirectory="%BUILD_OUTPUT%" ^
-prereqs ^ -prereqs ^
-nodebuginfo -nodebuginfo
set BUILD_EXIT=%errorlevel% set BUILD_EXIT=%errorlevel%
echo. echo.
echo UAT exited with code: %BUILD_EXIT% echo UAT exited with code: %BUILD_EXIT%
if %BUILD_EXIT% neq 0 ( if %BUILD_EXIT% neq 0 (
echo ERROR: Build failed! echo ERROR: Build failed for %THIS_CONFIG%!
pause exit /b 1
)
echo Build succeeded for %THIS_CONFIG%!
echo Build folder: %BUILD_OUTPUT%
if %RUN_STEPS% EQU 1 exit /b 0
:: ---- STEP 2: UPLOAD TO STEAM ----
if /I "%THIS_CONFIG%"=="DebugGame" (
echo.
echo DebugGame is local-only - skipping Steam upload for this config.
exit /b 0
)
echo.
echo [2/2] Uploading %THIS_CONFIG% build to Steam...
set STEAM_DEPOT=%STEAM_DEPOT_SHIPPING%
if "%STEAM_DEPOT%"=="" (
echo ERROR: No Steam depot ID configured for Shipping. Skipping upload.
exit /b 1 exit /b 1
) )
echo Build succeeded! if not exist "%STEAM_VDF_DIR%" mkdir "%STEAM_VDF_DIR%"
if %RUN_STEPS% EQU 1 goto :done set APP_VDF=%STEAM_VDF_DIR%\app_build_%THIS_CONFIG%.vdf
set DEPOT_VDF=%STEAM_VDF_DIR%\depot_build_%THIS_CONFIG%.vdf
:: ==================================== :: Generate depot script - points at the build output directly
:: STEP 2 — ZIP (
:: ==================================== echo "DepotBuildConfig"
echo. echo {
echo [2/2] Zipping build... echo "DepotID" "%STEAM_DEPOT%"
echo "ContentRoot" "%BUILD_OUTPUT%"
echo "FileMapping"
echo {
echo "LocalPath" "*"
echo "DepotPath" "."
echo "recursive" "1"
echo }
echo }
) > "%DEPOT_VDF%"
set ZIP_PATH=%OUTPUT_DIR%\%DEST_FILENAME% :: Generate app build script
(
echo "AppBuild"
echo {
echo "AppID" "%STEAM_APP_ID%"
echo "Desc" "%PROJECT_NAME% %BUILD_VERSION% [%THIS_CONFIG%] - %CHANGELOG%"
echo "ContentRoot" "%BUILD_OUTPUT%"
echo "BuildOutput" "%STEAM_VDF_DIR%\output_%THIS_CONFIG%"
echo "Depots"
echo {
echo "%STEAM_DEPOT%" "%DEPOT_VDF%"
echo }
echo }
) > "%APP_VDF%"
powershell -Command "Compress-Archive -Path '%BUILD_OUTPUT%\*' -DestinationPath '%ZIP_PATH%' -Force" "%STEAMCMD_PATH%" +login %STEAM_USERNAME% +run_app_build "%APP_VDF%" +quit
set STEAM_EXIT=%errorlevel%
if %errorlevel% neq 0 ( if %STEAM_EXIT% neq 0 (
echo ERROR: Zipping failed. echo ERROR: Steam upload failed for %THIS_CONFIG% ^(exit code %STEAM_EXIT%^).
pause & exit /b 1 exit /b 1
) )
echo Steam upload succeeded for %THIS_CONFIG%!
echo Zip created: %ZIP_PATH% exit /b 0
echo Build folder kept at: %BUILD_OUTPUT%
if %RUN_STEPS% EQU 2 goto :done
:: ====================================
:done
:: ====================================
echo.
echo ===================================
echo All done! (ran steps 1-%RUN_STEPS%)
echo Build: %DEST_FILENAME%
echo ===================================
pause

Binary file not shown.

Binary file not shown.

View File

@@ -122,6 +122,7 @@ bool ULTweenTickHelperWorldSubsystem::ShouldCreateSubsystem(UObject* Outer) cons
} }
void ULTweenTickHelperWorldSubsystem::PostInitialize() void ULTweenTickHelperWorldSubsystem::PostInitialize()
{ {
Super::PostInitialize();
if (auto World = GetWorld()) if (auto World = GetWorld())
{ {
if (World->IsGameWorld()) if (World->IsGameWorld())

View File

@@ -1,386 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#include "AsyncNode.h"
#include "UniversalCamera.h"
#include "GameFramework/Actor.h"
#include "Components/SplineComponent.h"
// ---------------------------- ASYNC NODE ---------------------------------------
UAsyncNode* UAsyncNode::CameraTravel(AUniversalCamera* UniversalCamera, FTargetSettings TargetSettings, FTargetVector LocationSettings, FOffsetSettings OffsetSettings, FTargetFloat YawSettings, FTargetFloat PitchSettings, FTargetFloat RollSettings, FTargetFloat ZoomSettings, UCurveFloat* Curve, FTravelSpeedSettings SpeedSettings, bool LockAllMovement, bool IgnoreLag, bool IgnoreRestrictions)
{
if (!UniversalCamera) return nullptr;
if (LocationSettings.TargetMod == TargetMod_None && OffsetSettings.OffsetMod == 0 && YawSettings.TargetMod == TargetMod_None && PitchSettings.TargetMod == TargetMod_None && RollSettings.TargetMod == TargetMod_None && ZoomSettings.TargetMod == TargetMod_None) return nullptr;
// Calculate Location Direction -------------------------------------------------
FVector StartingLocation, LocationDirection;
bool IsValidLocation = false;
if (LocationSettings.TargetMod == ETargetMod::TargetMod_Spline)
{
IsValidLocation = IsValid(LocationSettings.SplineComponent);
}
else
{
StartingLocation = UniversalCamera->DesiredLocation;
LocationDirection = LocationSettings.GetDirection(UniversalCamera, TargetSettings, StartingLocation, IgnoreRestrictions, IsValidLocation);
}
// Offset -----------------------------------------------------------
bool IsValidOffset = false;
FVector StartingOffset = FVector(0.f, 0.f, 0.f);
switch (OffsetSettings.OffsetMod)
{
case 1:
StartingOffset = UniversalCamera->DesiredTargetOffset;
break;
case 2:
StartingOffset = UniversalCamera->DesiredSocketOffset;
break;
};
FVector OffsetDirection = OffsetSettings.GetDirection(UniversalCamera, IgnoreRestrictions, IsValidOffset);
// Yaw -----------------------------------------------------------
bool IsValidYaw = false;
float StartingYaw = UniversalCamera->DesiredRotation.Yaw;
float YawDirection = YawSettings.GetDirection(UniversalCamera, 0, TargetSettings, StartingYaw, IgnoreRestrictions, IsValidYaw);
// Pitch ---------------------------------------------------------
bool IsValidPitch = false;
float StartingPitch = UniversalCamera->DesiredRotation.Pitch;
float PitchDirection = PitchSettings.GetDirection(UniversalCamera, 1, TargetSettings, StartingPitch, IgnoreRestrictions, IsValidPitch);
// Roll -----------------------------------------------------------
bool IsValidRoll = false;
float StartingRoll = UniversalCamera->DesiredRotation.Roll;
float RollDirection = RollSettings.GetDirection(UniversalCamera, 2, TargetSettings, StartingRoll, IgnoreRestrictions, IsValidRoll);
// Zoom --------------------------------------------------------
bool IsValidZoom = false;
float StartingZoom = UniversalCamera->DesiredZoom;
float ZoomDirection = ZoomSettings.GetDirection(UniversalCamera, 3, TargetSettings, StartingZoom, IgnoreRestrictions, IsValidZoom);;
// Return if all settings are invalid
if (!(IsValidLocation || IsValidOffset || IsValidYaw || IsValidPitch || IsValidRoll || IsValidZoom)) return nullptr;
// Calculate the duration from the speed -------------------
float Duration = 0.f;
if (!SpeedSettings.UseSpeed)
{
Duration = SpeedSettings.Duration;
}
float DurationTemp = 0.f;
if (IsValidLocation)
{
if (SpeedSettings.UseSpeed)
{
if (LocationSettings.TargetMod == ETargetMod::TargetMod_Spline)
{
if (LocationSettings.SplineComponent)
{
Duration = LocationSettings.SplineComponent->GetSplineLength() / SpeedSettings.Speed;
}
}
else
{
float LocationDistance = LocationDirection.Length();
Duration = FMath::Abs(LocationDistance / SpeedSettings.Speed);
}
}
}
// Calculate the farthest target (using the multiplier) and set it as the duration reference if using speed
float OffsetLength = OffsetDirection.Length();
SpeedSettings.DurationInitializer(IsValidOffset, OffsetLength, &Duration, 1.f);
SpeedSettings.DurationInitializer(IsValidYaw, YawDirection, &Duration, 5.f);
SpeedSettings.DurationInitializer(IsValidPitch, PitchDirection, &Duration, 5.f);
SpeedSettings.DurationInitializer(IsValidRoll, RollDirection, &Duration, 5.f);
SpeedSettings.DurationInitializer(IsValidZoom, ZoomDirection, &Duration, 3.f);
// Instantiate and initialize the Task ----------
UAsyncNode* NewNode = NewObject<UAsyncNode>();
if (!IsValid(NewNode)) return nullptr;
// Camera
NewNode->m_UniversalCamera = UniversalCamera;
NewNode->m_IgnoreLag = IgnoreLag;
NewNode->m_IgnoreRestrictions = IgnoreRestrictions;
// Time
NewNode->MaxDuration = Duration;
// Duration
NewNode->TargetSettings = TargetSettings;
// Location
NewNode->LocationSettings = LocationSettings;
NewNode->StartingLocation = StartingLocation;
NewNode->LocationDirection = LocationDirection;
NewNode->IsValidLocation = IsValidLocation;
// Offset
NewNode->OffsetSettings = OffsetSettings;
NewNode->StartingOffset = StartingOffset;
NewNode->OffsetDirection = OffsetDirection;
NewNode->IsValidOffset = IsValidOffset;
// Yaw
NewNode->YawSettings = YawSettings;
NewNode->StartingYaw = StartingYaw;
NewNode->YawDirection = YawDirection;
NewNode->IsValidYaw = IsValidYaw;
// Pitch
NewNode->PitchSettings = PitchSettings;
NewNode->StartingPitch = StartingPitch;
NewNode->PitchDirection = PitchDirection;
NewNode->IsValidPitch = IsValidPitch;
// Roll
NewNode->RollSettings = RollSettings;
NewNode->StartingRoll = StartingRoll;
NewNode->RollDirection = RollDirection;
NewNode->IsValidRoll = IsValidRoll;
// Zoom
NewNode->ZoomSettings = ZoomSettings;
NewNode->StartingZoom = StartingZoom;
NewNode->ZoomDirection = ZoomDirection;
NewNode->IsValidZoom = IsValidZoom;
// Curve
NewNode->m_Curve = Curve;
// Lock Movement
NewNode->m_LockAllMovement = LockAllMovement;
UniversalCamera->StartTraveling_Internal(NewNode);
return NewNode;
}
void UAsyncNode::TryUpdateLocationDirectionAndValidity()
{
switch (LocationSettings.TargetMod)
{
case TargetMod_Actor:
case TargetMod_Socket:
case TargetMod_SceneComponent:
LocationDirection = GetLocationDirection(IsValidLocation);
break;
case TargetMod_Spline:
IsValidLocation = IsValid(LocationSettings.SplineComponent);
break;
}
}
void UAsyncNode::TryUpdateFloatDirectionAndValidity(FTargetFloat* FloatSettings, float* FloatValue, DirectionFunction GetFloatDirection, bool* IsValidBool)
{
switch (FloatSettings->TargetMod)
{
case TargetMod_Actor:
case TargetMod_Socket:
case TargetMod_SceneComponent:
*FloatValue = (*this.*GetFloatDirection)(*IsValidBool);
}
}
// ---------------------------- TRAVEL SPEED SETTINGS ---------------------------------------
void FTravelSpeedSettings::DurationInitializer(bool IsValidBool, float Direction, float* DurationRef, float Multiplier)
{
if (IsValidBool)
{
if (UseSpeed)
{
float DurationTemp = FMath::Abs(Direction * Multiplier / Speed);
if (DurationTemp > *DurationRef) *DurationRef = DurationTemp;
}
else
{
*DurationRef = Duration;
}
}
}
// ---------------------------- TARGET VECTOR ---------------------------------------
FVector FTargetVector::GetLocation(AUniversalCamera* UniversalCamera, FTargetSettings TargetSettings, bool& IsValid)
{
IsValid = false;
if (UniversalCamera->IsFollowingAnyActor()) return FVector(0.f, 0.f, 0.f);
switch (TargetMod)
{
case TargetMod_None:
return FVector(0.f, 0.f, 0.f);
case TargetMod_CustomValue:
IsValid = true;
return VectorValue;
case TargetMod_Actor:
IsValid = TargetSettings.IsValidActor();
if (IsValid)
{
return TargetSettings.GetActorLocation();
}
else return FVector(0.f, 0.f, 0.f);
case TargetMod_Socket:
IsValid = TargetSettings.IsValidSocket();
if (IsValid)
{
return TargetSettings.GetSocketLocation();
}
else return FVector(0.f, 0.f, 0.f);
case TargetMod_SceneComponent:
IsValid = TargetSettings.IsValidSceneComponent();
if (IsValid)
{
return TargetSettings.GetSceneComponentLocation();
}
else return FVector(0.f, 0.f, 0.f);
}
return FVector(0.f, 0.f, 0.f);
}
FVector FTargetVector::GetDirection(AUniversalCamera* UniversalCamera, FTargetSettings TargetSettings, FVector StartingLocation, bool IgnoreRestrictions, bool& IsValid)
{
IsValid = false;
FVector Location = GetLocation(UniversalCamera, TargetSettings, IsValid);
if (!IgnoreRestrictions) Location = UniversalCamera->GetCorrectedDestinationFromRestrictions(Location);
return Location - StartingLocation;
}
// ---------------------------- TARGET OFFSET ---------------------------------------
FVector FOffsetSettings::GetDirection(AUniversalCamera* UniversalCamera, bool IgnoreRestrictions, bool& IsValidOffset)
{
IsValidOffset = false;
FVector Offset = IgnoreRestrictions ? OffsetValue : UniversalCamera->GetClampedOffset(OffsetValue);
switch (OffsetMod)
{
case 1:
IsValidOffset = true;
return Offset - UniversalCamera->DesiredTargetOffset;
case 2:
IsValidOffset = true;
return Offset - UniversalCamera->DesiredSocketOffset;
};
return FVector(0.f, 0.f, 0.f);
}
// ---------------------------- TARGET FLOAT ---------------------------------------
float FTargetFloat::GetRotationValue(AUniversalCamera* UniversalCamera, int32 Type, FTargetSettings TargetSettings, bool IgnoreRestrictions, bool& IsValid)
{
IsValid = false;
FRotator RotatorValue(0.f, 0.f, 0.f);
switch (TargetMod)
{
case TargetMod_None:
return 0.f;
case TargetMod_CustomValue:
IsValid = true;
return FloatValue;
case TargetMod_Actor:
IsValid = TargetSettings.IsValidActor();
if (IsValid)
{
RotatorValue = TargetSettings.GetActorRotation();
break;
}
else return 0.f;
case TargetMod_Socket:
IsValid = TargetSettings.IsValidSocket();
if (IsValid)
{
RotatorValue = TargetSettings.GetSocketRotation();
break;
}
else return 0.f;
case TargetMod_SceneComponent:
IsValid = TargetSettings.IsValidSceneComponent();
if (IsValid)
{
RotatorValue = TargetSettings.GetSceneComponentRotation();
break;
}
else return 0.f;
}
if (Type == 0)
{
if (!IgnoreRestrictions) RotatorValue.Yaw = UniversalCamera->GetClampedYaw(RotatorValue.Yaw);
return RotatorValue.Yaw;
}
else if (Type == 1)
{
if (!IgnoreRestrictions) RotatorValue.Pitch = UniversalCamera->GetClampedYaw(RotatorValue.Pitch);
return RotatorValue.Pitch;
}
else if (Type == 2)
{
if (!IgnoreRestrictions) RotatorValue.Roll = UniversalCamera->GetClampedYaw(RotatorValue.Roll);
return RotatorValue.Roll;
}
return 0.f;
}
float FTargetFloat::GetZoomValue(FTargetSettings TargetSettings, bool& IsValid)
{
IsValid = false;
switch (TargetMod)
{
case TargetMod_CustomValue:
IsValid = true;
return FloatValue;
case TargetMod_Actor:
return TargetSettings.GetTargetActorZoom(IsValid);
}
return 0.f;
}
float FTargetFloat::GetDirection(AUniversalCamera* UniversalCamera, int32 Type, FTargetSettings TargetSettings, float StartingValue, bool IgnoreRestrictions, bool& IsValid)
{
IsValid = false;
if (Type < 3)
{
float RotationValue = GetRotationValue(UniversalCamera, Type, TargetSettings, IgnoreRestrictions, IsValid);
float Delta = RotationValue - StartingValue;
if (Delta > 180.0f)
{
Delta -= 360.0f;
}
else if (Delta < -180.0f)
{
Delta += 360.0f;
}
return Delta;
}
else if (Type == 3)
{
float ZoomValue = GetZoomValue(TargetSettings, IsValid);
if (!IgnoreRestrictions) ZoomValue = UniversalCamera->GetClampedZoom(ZoomValue);
return ZoomValue - StartingValue;
}
return 0.f;
}

View File

@@ -1,36 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#include "PlaceholderCamera.h"
// Sets default values
APlaceholderCamera::APlaceholderCamera()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = false;
SpringArmComponent = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComponent"));
SpringArmComponent->SetupAttachment(RootComponent);
SpringArmComponent->bDoCollisionTest = false;
SpringArmComponent->TargetArmLength = 400.0f;
CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComponent"));
CameraComponent->SetupAttachment(SpringArmComponent);
}
// Called when the game starts or when spawned
void APlaceholderCamera::BeginPlay()
{
Super::BeginPlay();
}
FPlaceholderCameraInfos APlaceholderCamera::GetInfos()
{
FPlaceholderCameraInfos Infos;
Infos.Location = GetActorLocation();
Infos.Yaw = GetActorRotation().Yaw;
Infos.Pitch = GetActorRotation().Pitch;
Infos.Zoom = GetZoom();
return Infos;
}

View File

@@ -1,56 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#include "SharedStructs.h"
#include "GameFramework/SpringArmComponent.h"
#include "UniversalCamera.h"
bool FTargetSettings::IsValidActor() const
{
return IsValid(Actor);
}
bool FTargetSettings::IsValidSocket() const
{
return IsValid(Mesh) && Mesh->DoesSocketExist(Socket);
}
bool FTargetSettings::IsValidSceneComponent() const
{
return IsValid(SceneComponent);
}
float FTargetSettings::GetTargetActorZoom(bool& IsValidTarget)
{
IsValidTarget = false;
if (!IsValidActor())
{
return 0.f;
}
// Return the TargetArmLength if target has a SpringArmComponent
USpringArmComponent* SpringArmComponent = Cast<USpringArmComponent>(Actor->GetComponentByClass(USpringArmComponent::StaticClass()));
if (IsValid(SpringArmComponent))
{
IsValidTarget = true;
return SpringArmComponent->TargetArmLength;
}
// Return the DesiredZoom is target is a UniversalCamera
AUniversalCamera* UniversalCameraRef = Cast<AUniversalCamera>(Actor);
if (IsValid(UniversalCameraRef))
{
IsValidTarget = true;
return UniversalCameraRef->DesiredZoom;
}
return 0.f;
}
AActor* FTargetSettings::GetOwnerActor() const
{
if (IsValidActor()) return Actor;
if (IsValidSocket()) return Mesh->GetOwner();
if (IsValidSceneComponent()) return SceneComponent->GetOwner();
return nullptr;
}

View File

@@ -1,20 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#include "UniversalCameraPlugin.h"
#define LOCTEXT_NAMESPACE "FUniversalCameraPluginModule"
void FUniversalCameraPluginModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}
void FUniversalCameraPluginModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FUniversalCameraPluginModule, UniversalCameraPlugin)

View File

@@ -1,5 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#include "UniversalCameraSaveGame.h"

View File

@@ -1,307 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintAsyncActionBase.h"
#include "SharedStructs.h"
#include "AsyncNode.generated.h"
class AUniversalCamera;
class UCurveFloat;
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FTravelSpeedSettings
{
GENERATED_BODY()
FTravelSpeedSettings() {}
UPROPERTY()
bool UseSpeed = false;
UPROPERTY()
float Speed = 1000.f;
UPROPERTY()
float Duration = 2.f;
void DurationInitializer(bool IsValidBool, float Direction, float* DurationRef, float Multiplier);
};
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FTargetVector
{
GENERATED_BODY()
FTargetVector() {}
UPROPERTY()
TEnumAsByte<ETargetMod> TargetMod = ETargetMod::TargetMod_None;
UPROPERTY()
class USplineComponent* SplineComponent = nullptr;
UPROPERTY()
FVector VectorValue = FVector(0.f, 0.f, 0.f);
FVector GetLocation(AUniversalCamera* UniversalCamera, FTargetSettings TargetSettings, bool& IsValid);
FVector GetDirection(AUniversalCamera* UniversalCamera, FTargetSettings TargetSettings, FVector StartingLocation, bool IgnoreRestrictions, bool& IsValid);
};
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FOffsetSettings
{
GENERATED_BODY()
FOffsetSettings() {}
// 0 - None
// 1 - Target Offset
// 2 - Socket Offset
UPROPERTY()
int32 OffsetMod = 0;
UPROPERTY()
FVector OffsetValue = FVector(0.f, 0.f, 0.f);
FVector GetDirection(AUniversalCamera* UniversalCamera, bool IgnoreRestrictions, bool& IsValidOffset);
};
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FTargetFloat
{
GENERATED_BODY()
FTargetFloat() {}
UPROPERTY()
TEnumAsByte<ETargetMod> TargetMod = ETargetMod::TargetMod_None;
UPROPERTY()
float FloatValue = 0.f;
// 0 for Yaw, 1 for Pitch, 2 for Roll, 3 for Zoom
float GetDirection(AUniversalCamera* UniversalCamera, int32 Type, FTargetSettings TargetSettings, float StartingValue, bool IgnoreRestrictions, bool& IsValid);
float GetRotationValue(AUniversalCamera* UniversalCamera, int32 Type, FTargetSettings TargetSettings, bool IgnoreRestrictions, bool& IsValid);
float GetZoomValue(FTargetSettings TargetSettings, bool& IsValid);
};
UCLASS()
class UNIVERSALCAMERAPLUGIN_API UAsyncNode : public UBlueprintAsyncActionBase
{
GENERATED_BODY()
public:
// CameraTravel to the specified Location.
// Drag any pin and type in "Use" with Context Sensitive enabled to see the different options.
// Use the "AbortTravelTask()" function to abort.
// All of the settings are optional, but at least one must be valid.
// @Param TargetSettings Set the Target References that can be used by other settings.
// @Param Curve Must go from (0;0) to (1;1).
// @Param LockAllMovement If true, Movement, Rotation and Zoom will be locked during the traveling. If false, only valid settings will be locked.
// @Param IgnoreRestrictions Ignore Restrictions and Collisions
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"))
static UAsyncNode* CameraTravel(AUniversalCamera* UniversalCamera, FTargetSettings TargetSettings, FTargetVector LocationSettings, FOffsetSettings OffsetSettings, FTargetFloat YawSettings, FTargetFloat PitchSettings, FTargetFloat RollSettings, FTargetFloat ZoomSettings, UCurveFloat* Curve, FTravelSpeedSettings SpeedSettings, bool LockAllMovement, bool IgnoreLag, bool IgnoreRestrictions);
// Camera
AUniversalCamera* m_UniversalCamera;
bool m_IgnoreRestrictions = false;
bool m_IgnoreLag = false;
// Time
float MaxDuration = 0.f;
float ElapsedTime = 0.f;
bool IgnoreTimeDilation = false;
// Duration
FTargetSettings TargetSettings;
// Location
FTargetVector LocationSettings;
FVector StartingLocation;
FVector LocationDirection;
bool IsValidLocation;
// Offset
FOffsetSettings OffsetSettings;
FVector StartingOffset;
FVector OffsetDirection;
bool IsValidOffset;
// Yaw
FTargetFloat YawSettings;
float StartingYaw;
float YawDirection;
bool IsValidYaw;
// Pitch
FTargetFloat PitchSettings;
float StartingPitch;
float PitchDirection;
bool IsValidPitch;
// Roll
FTargetFloat RollSettings;
float StartingRoll;
float RollDirection;
bool IsValidRoll;
// Zoom
FTargetFloat ZoomSettings;
float StartingZoom;
float ZoomDirection;
bool IsValidZoom;
// Curve
UCurveFloat* m_Curve;
// Lock Movement
bool m_LockAllMovement = false;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnTaskResult);
// Called if the task ended and the camera successfully reached the destination
UPROPERTY(BlueprintAssignable)
FOnTaskResult OnReachedDestination;
// Called if the task ended prematurely
UPROPERTY(BlueprintAssignable)
FOnTaskResult OnAborted;
FORCEINLINE bool IsValidTargetLocation(AUniversalCamera* UniversalCamera) { bool IsValid; LocationSettings.GetLocation(m_UniversalCamera, TargetSettings, IsValid); return IsValid; }
FORCEINLINE FVector GetLocationDirection(bool& IsValid) { return LocationSettings.GetDirection(m_UniversalCamera, TargetSettings, StartingLocation, m_IgnoreRestrictions, IsValid); }
// GetDirection: 0 Yaw - 1 Pitch - 2 Roll - 3 Zoom
FORCEINLINE float IsValidTargetYaw() { bool IsValid; YawSettings.GetRotationValue(m_UniversalCamera, 0, TargetSettings, m_IgnoreRestrictions, IsValid); return IsValid; }
FORCEINLINE float GetYawDirection(bool& IsValid) { return YawSettings.GetDirection(m_UniversalCamera, 0, TargetSettings, StartingYaw, m_IgnoreRestrictions, IsValid); }
FORCEINLINE float IsValidTargetPitch() { bool IsValid; PitchSettings.GetRotationValue(m_UniversalCamera, 1, TargetSettings, m_IgnoreRestrictions, IsValid); return IsValid; }
FORCEINLINE float GetPitchDirection(bool& IsValid) { return PitchSettings.GetDirection(m_UniversalCamera, 1, TargetSettings, StartingPitch, m_IgnoreRestrictions, IsValid); }
FORCEINLINE float IsValidTargetRoll() { bool IsValid; RollSettings.GetRotationValue(m_UniversalCamera, 2, TargetSettings, m_IgnoreRestrictions, IsValid); return IsValid; }
FORCEINLINE float GetRollDirection(bool& IsValid) { return RollSettings.GetDirection(m_UniversalCamera, 2, TargetSettings, StartingRoll, m_IgnoreRestrictions, IsValid); }
FORCEINLINE float IsValidTargetZoom() { bool IsValid; ZoomSettings.GetZoomValue(TargetSettings, IsValid); return IsValid; }
FORCEINLINE float GetZoomDirection(bool& IsValid) { return ZoomSettings.GetDirection(m_UniversalCamera, 3, TargetSettings, StartingZoom, m_IgnoreRestrictions, IsValid); }
void TryUpdateLocationDirectionAndValidity();
FORCEINLINE void TryUpdateYawDirectionAndValidity() { TryUpdateFloatDirectionAndValidity(&YawSettings, &YawDirection, &UAsyncNode::GetYawDirection, &IsValidYaw); }
FORCEINLINE void TryUpdatePitchDirectionAndValidity() { TryUpdateFloatDirectionAndValidity(&PitchSettings, &PitchDirection, &UAsyncNode::GetPitchDirection, &IsValidPitch); }
FORCEINLINE void TryUpdateRollDirectionAndValidity() { TryUpdateFloatDirectionAndValidity(&RollSettings, &RollDirection, &UAsyncNode::GetRollDirection, &IsValidRoll); }
FORCEINLINE void TryUpdateZoomDirectionAndValidity() { TryUpdateFloatDirectionAndValidity(&ZoomSettings, &ZoomDirection, &UAsyncNode::GetZoomDirection, &IsValidZoom); }
FORCEINLINE bool AreValidSettings() const { return (IsValidLocation || IsValidOffset || IsValidYaw || IsValidPitch || IsValidRoll || IsValidZoom); }
protected:
typedef float (UAsyncNode::*DirectionFunction)(bool&);
void TryUpdateFloatDirectionAndValidity(FTargetFloat* FloatSettings, float* FloatValue, DirectionFunction GetFloatDirection, bool* IsValidBool);
// MAKE BP SETTINGS (USER FRIENDLY)
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetVector UseCustomLocation(const FVector Location)
{
FTargetVector Settings;
Settings.TargetMod = TargetMod_CustomValue;
Settings.VectorValue = Location;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetVector UseSpline(class USplineComponent* SplineComponent)
{
FTargetVector Settings;
Settings.TargetMod = TargetMod_Spline;
Settings.SplineComponent = SplineComponent;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetVector UseActorLocation()
{
FTargetVector Settings;
Settings.TargetMod = TargetMod_Actor;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetVector UseSocketLocation()
{
FTargetVector Settings;
Settings.TargetMod = TargetMod_Socket;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetVector UseSceneComponentLocation()
{
FTargetVector Settings;
Settings.TargetMod = TargetMod_SceneComponent;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetFloat UseCustomValue(const float Value = 0.f)
{
FTargetFloat Settings;
Settings.TargetMod = TargetMod_CustomValue;
Settings.FloatValue = Value;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetFloat UseActorValue()
{
FTargetFloat Settings;
Settings.TargetMod = TargetMod_Actor;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetFloat UseSocketValue()
{
FTargetFloat Settings;
Settings.TargetMod = TargetMod_Socket;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTargetFloat UseSceneComponentValue()
{
FTargetFloat Settings;
Settings.TargetMod = TargetMod_SceneComponent;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTravelSpeedSettings UseSpeed(const float Speed = 1000.f)
{
FTravelSpeedSettings Settings;
Settings.UseSpeed = true;
Settings.Speed = Speed;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FTravelSpeedSettings UseDuration(const float Duration = 2.f)
{
FTravelSpeedSettings Settings;
Settings.UseSpeed = false;
Settings.Duration = Duration;
return Settings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FOffsetSettings UseTargetOffset(const FVector TargetOffset)
{
FOffsetSettings OffsetSettings;
OffsetSettings.OffsetMod = 1;
OffsetSettings.OffsetValue = TargetOffset;
return OffsetSettings;
}
UFUNCTION(BlueprintPure, meta = (Keywords = "Make"), Category = "AsyncNode|Settings")
static FOffsetSettings UseSocketOffset(const FVector SocketOffset)
{
FOffsetSettings OffsetSettings;
OffsetSettings.OffsetMod = 2;
OffsetSettings.OffsetValue = SocketOffset;
return OffsetSettings;
}
// virtual void Activate() override;
};

View File

@@ -1,54 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"
#include "PlaceholderCamera.generated.h"
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FPlaceholderCameraInfos
{
GENERATED_BODY()
FPlaceholderCameraInfos() {}
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "PlaceholderCameraInfos")
FVector Location = FVector(0.f, 0.f, 0.f);
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "PlaceholderCameraInfos")
float Yaw = 0.f;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "PlaceholderCameraInfos")
float Pitch = 0.f;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "PlaceholderCameraInfos")
float Zoom = 0.f;
};
UCLASS()
class UNIVERSALCAMERAPLUGIN_API APlaceholderCamera : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
APlaceholderCamera();
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Components")
TObjectPtr<USpringArmComponent> SpringArmComponent;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Components")
TObjectPtr<UCameraComponent> CameraComponent;
UFUNCTION(BlueprintPure, Category = "PlaceholderCameraInfos")
float GetZoom() { return SpringArmComponent->TargetArmLength; }
UFUNCTION(BlueprintPure, Category = "PlaceholderCameraInfos")
FPlaceholderCameraInfos GetInfos();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
};

View File

@@ -1,77 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#pragma once
#include "CoreMinimal.h"
#include "Components/MeshComponent.h"
#include "SharedStructs.generated.h"
UENUM(BlueprintType)
enum ETargetMod
{
TargetMod_None UMETA(DisplayName = "None"),
TargetMod_CustomValue UMETA(DisplayName = "CustomValue"),
TargetMod_Spline UMETA(DisplayName = "Spline"),
TargetMod_Actor UMETA(DisplayName = "Actor"),
TargetMod_Socket UMETA(DisplayName = "Socket"),
TargetMod_SceneComponent UMETA(DisplayName = "SceneComponent")
};
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FUniversalCameraPositionSaveFormat
{
GENERATED_BODY()
FUniversalCameraPositionSaveFormat() {}
UPROPERTY()
FVector DesiredLocation = FVector::ZeroVector;
UPROPERTY()
FVector DesiredSocketOffset = FVector::ZeroVector;
UPROPERTY()
FVector DesiredTargetOffset = FVector::ZeroVector;
UPROPERTY()
FRotator DesiredRotation = FRotator::ZeroRotator;
UPROPERTY()
FRotator DesiredRotationOffset = FRotator::ZeroRotator;
UPROPERTY()
float DesiredZoom = 0.f;
};
USTRUCT(Blueprintable)
struct UNIVERSALCAMERAPLUGIN_API FTargetSettings
{
GENERATED_BODY()
FTargetSettings() {}
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Universal Camera Plugin|Restrictions")
AActor* Actor = nullptr;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Universal Camera Plugin|Restrictions")
USceneComponent* SceneComponent = nullptr;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Universal Camera Plugin|Restrictions")
UMeshComponent* Mesh = nullptr;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Universal Camera Plugin|Restrictions")
FName Socket;
bool IsValidActor() const;
// Check for validity before calling those
FORCEINLINE FVector GetActorLocation() const { return Actor->GetActorLocation(); }
FORCEINLINE FRotator GetActorRotation() const { return Actor->GetActorRotation(); }
bool IsValidSocket() const;
// Check for validity before calling those
FORCEINLINE FVector GetSocketLocation() const { return Mesh->GetSocketLocation(Socket); }
FORCEINLINE FRotator GetSocketRotation() const { return Mesh->GetSocketRotation(Socket); }
bool IsValidSceneComponent() const;
// Check for validity before calling those
FORCEINLINE FVector GetSceneComponentLocation() const { return SceneComponent->GetComponentLocation(); }
FORCEINLINE FRotator GetSceneComponentRotation() const { return SceneComponent->GetComponentRotation(); }
// Check for validity before calling those
float GetTargetActorZoom(bool& IsValidTarget);
AActor* GetOwnerActor() const;
};

View File

@@ -1,15 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
class FUniversalCameraPluginModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};

View File

@@ -1,31 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/SaveGame.h"
#include "SharedStructs.h"
#include "UniversalCameraSaveGame.generated.h"
/**
*
*/
UCLASS()
class UNIVERSALCAMERAPLUGIN_API UUniversalCameraSaveGame : public USaveGame
{
GENERATED_BODY()
public:
UPROPERTY()
FUniversalCameraPositionSaveFormat SavedPosition;
UPROPERTY()
bool bIsValidSavePosition = false;
UPROPERTY()
TArray<uint8> SavedSettings;
UPROPERTY()
bool bIsValidSaveSettings = false;
};

View File

@@ -1,60 +0,0 @@
// Universal Camera Plugin - Mathieu Jacq 2021
using System.IO;
using UnrealBuildTool;
public class UniversalCameraPlugin : ModuleRules
{
public UniversalCameraPlugin(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PrecompileForTargets = PrecompileTargetsType.Any;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"UMG",
"CinematicCamera",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}

View File

@@ -1,28 +0,0 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.19",
"FriendlyName": "Universal Camera Plugin",
"Description": "A customizable Camera!",
"Category": "Camera",
"CreatedBy": "Heac",
"CreatedByURL": "https://www.youtube.com/channel/UCLObFuW7-nONzZpK8waeBXg/videos",
"DocsURL": "https://1drv.ms/b/s!AhiJ5zgIv0iHhDUTtt4YFznnpebR?e=IfK8fr",
"MarketplaceURL": "com.epicgames.launcher://ue/Fab/product/3e455250-77f9-4341-8c8b-00d7d680f1ae",
"SupportURL": "mailto:heac.unreal@gmail.com",
"EngineVersion": "5.8.0",
"CanContainContent": false,
"Installed": true,
"Modules": [
{
"Name": "UniversalCameraPlugin",
"Type": "Runtime",
"LoadingPhase": "Default",
"PlatformAllowList": [
"Win64",
"Android",
"LinuxArm64"
]
}
]
}

View File

@@ -18,8 +18,7 @@
"AIModule", "AIModule",
"DeveloperSettings", "DeveloperSettings",
"Slate", "Slate",
"SlateCore", "SlateCore"
"GameplayAbilities"
] ]
}, },
{ {
@@ -112,11 +111,6 @@
"Enabled": true, "Enabled": true,
"MarketplaceURL": "https://unrealengineresources.com/plugins" "MarketplaceURL": "https://unrealengineresources.com/plugins"
}, },
{
"Name": "UniversalCameraPlugin",
"Enabled": true,
"MarketplaceURL": "com.epicgames.launcher://ue/Fab/product/3e455250-77f9-4341-8c8b-00d7d680f1ae"
},
{ {
"Name": "LTween", "Name": "LTween",
"Enabled": true, "Enabled": true,

View File

@@ -1,3 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=0CD3573C_002DB09F_002DB69D_002DC1DF_002DB6EE0C2BE671_002Fd_003APrivate_002Ff_003AAnimationEditorViewportClient_002Ecpp/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=0CD3573C_002DB09F_002DB69D_002DC1DF_002DB6EE0C2BE671_002Fd_003APrivate_002Ff_003AAnimationEditorViewportClient_002Ecpp/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=0CD3573C_002DB09F_002DB69D_002DC1DF_002DB6EE0C2BE671_002Fd_003APrivate_002Ff_003ASkeletonSelectionEditMode_002Ecpp/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=0CD3573C_002DB09F_002DB69D_002DC1DF_002DB6EE0C2BE671_002Fd_003APrivate_002Ff_003ASkeletonSelectionEditMode_002Ecpp/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AWyxudat_002Easm_002Fl_003A_002E_002E_003F_002E_002E_003FUsers_003Fadnan_003FAppData_003FLocal_003FTemp_003FSandboxFiles_003FPufoged_003FWyxudat_002Easm/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>

View File

@@ -21,7 +21,6 @@
#include "ProjectEleri/GameObjects/BookActor.h" #include "ProjectEleri/GameObjects/BookActor.h"
#include "UI/TradeWidget.h" #include "UI/TradeWidget.h"
#include "ProjectEleri/Public/UI/SelectionManager.h" #include "ProjectEleri/Public/UI/SelectionManager.h"
#include "RTSCameraPlugin/Public/UniversalCamera.h"
#include "ProjectEleri/DialogueSystem/DialogueWidget.h" #include "ProjectEleri/DialogueSystem/DialogueWidget.h"
AEleriPlayerController::AEleriPlayerController(const FObjectInitializer &ObjectInitializer) AEleriPlayerController::AEleriPlayerController(const FObjectInitializer &ObjectInitializer)
@@ -342,8 +341,8 @@ void AEleriPlayerController::OnMove(const FInputActionValue &Value)
// FVector ForwardFacing = UKismetMathLibrary::GetForwardVector(bFlying? PlayerCameraManager->GetCameraRotation() : CharRotForward); // FVector ForwardFacing = UKismetMathLibrary::GetForwardVector(bFlying? PlayerCameraManager->GetCameraRotation() : CharRotForward);
float AppliedMovementVelocity = 1.f; // MovementVelocity * (bFlying? 0.5f : 1.f); float AppliedMovementVelocity = 1.f; // MovementVelocity * (bFlying? 0.5f : 1.f);
FVector ForwardVec = AUniversalCamera::GetAlternativeForwardVector(PlayerCharacter->GetPlayerCamera()->DesiredRotation); FVector ForwardVec = PlayerCharacter->GetPlayerCamera()->GetForwardVector();
FVector RightVec = AUniversalCamera::GetAlternativeRightVector(PlayerCharacter->GetPlayerCamera()->DesiredRotation); FVector RightVec = PlayerCharacter->GetPlayerCamera()->GetRightVector();
PlayerCharacter->AddMovementInput(ForwardVec, MovementDirection.Y * AppliedMovementVelocity); PlayerCharacter->AddMovementInput(ForwardVec, MovementDirection.Y * AppliedMovementVelocity);
PlayerCharacter->AddMovementInput(RightVec, MovementDirection.X * AppliedMovementVelocity); PlayerCharacter->AddMovementInput(RightVec, MovementDirection.X * AppliedMovementVelocity);
@@ -409,8 +408,8 @@ void AEleriPlayerController::OnLook(const FInputActionValue &Value)
if (PlayerCharacter != nullptr) if (PlayerCharacter != nullptr)
{ {
PlayerCharacter->GetPlayerCamera()->RotateYaw(AnalogueValue.X); AddYawInput(AnalogueValue.X);
PlayerCharacter->GetPlayerCamera()->RotatePitch(AnalogueValue.Y); AddPitchInput(AnalogueValue.Y);
} }
} }

View File

@@ -13,8 +13,6 @@
#include "ProjectEleri/GameObjects/BookActor.h" #include "ProjectEleri/GameObjects/BookActor.h"
#include "TimeOfDayManager.h" #include "TimeOfDayManager.h"
#include "Components/PostProcessComponent.h" #include "Components/PostProcessComponent.h"
#include "Components/SceneCaptureComponent2D.h"
#include "Engine/TextureRenderTarget2D.h"
#include "GameFramework/PawnMovementComponent.h" #include "GameFramework/PawnMovementComponent.h"
#include "ProjectEleri/GameObjects/BenchmarkActor.h" #include "ProjectEleri/GameObjects/BenchmarkActor.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h" #include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
@@ -22,11 +20,8 @@
#include "ProjectEleri/GameObjects/BookActor.h" #include "ProjectEleri/GameObjects/BookActor.h"
#include "ProjectEleri/GameObjects/BroomActor.h" #include "ProjectEleri/GameObjects/BroomActor.h"
#include "Components/CapsuleComponent.h" #include "Components/CapsuleComponent.h"
#include "DisplayDebugHelpers.h"
#include "Components/StatForgeComponent.h" #include "Components/StatForgeComponent.h"
#include "Engine/Canvas.h" #include "GameFramework/SpringArmComponent.h"
#include "RTSCameraPlugin/Public/UniversalCamera.h"
#include "RTSCameraPlugin/Public/AsyncNode.h"
#if WITH_EDITOR #if WITH_EDITOR
@@ -78,10 +73,10 @@ void AMyCharacter::BeginPlay()
InteractableOverlapMesh->OnComponentEndOverlap.AddDynamic(this, &AMyCharacter::OnLeftInteractableObject); InteractableOverlapMesh->OnComponentEndOverlap.AddDynamic(this, &AMyCharacter::OnLeftInteractableObject);
} }
CameraRef = GetWorld()->SpawnActor<AUniversalCamera>(CameraClass, GetActorTransform()); CameraRef = GetComponentByClass<UCameraComponent>();
//CameraRef->AttachToActor(this, FAttachmentTransformRules::SnapToTargetNotIncludingScale); SpringArmRef = GetComponentByClass<USpringArmComponent>();
PlayerController->SetViewTarget(CameraRef); PlayerController->SetViewTarget(this);
CameraStartFollowPlayer(); SpringArmRef->TargetArmLength = DefaultZoom;
TSet<UActorComponent*> CameraComponents = GetComponents(); TSet<UActorComponent*> CameraComponents = GetComponents();
for (auto Comp : CameraComponents) for (auto Comp : CameraComponents)
@@ -100,7 +95,7 @@ void AMyCharacter::BeginPlay()
BookTransform.SetRotation(FRotator(0,0,0).Quaternion()); BookTransform.SetRotation(FRotator(0,0,0).Quaternion());
BookTransform.SetScale3D(FVector::OneVector); BookTransform.SetScale3D(FVector::OneVector);
BookActor = GetWorld()->SpawnActor<ABookActor>(BookActorClass, BookTransform); BookActor = GetWorld()->SpawnActor<ABookActor>(BookActorClass, BookTransform);
BookActor->AttachToActor(CameraRef.Get(), FAttachmentTransformRules::KeepRelativeTransform); BookActor->AttachToComponent(CameraRef.Get(), FAttachmentTransformRules::KeepRelativeTransform);
BookActor->SetActorRelativeLocation(FVector(300,0,0)); BookActor->SetActorRelativeLocation(FVector(300,0,0));
BookActor->SetActorRelativeRotation(FRotator(0,90,0).Quaternion()); BookActor->SetActorRelativeRotation(FRotator(0,90,0).Quaternion());
@@ -144,10 +139,10 @@ void AMyCharacter::Tick(float DeltaTime)
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
if (CurrentZoomTimer > 0.f) { if (CurrentZoomTimer > 0.f) {
float ZoomDelta = (NextZoomOffsetTarget * DeltaTime) / ZoomTime; const float ZoomDelta = (NextZoomOffsetTarget * DeltaTime) / ZoomTime;
CameraRef->ZoomIn(ZoomDelta, 0.01f); SpringArmRef->TargetArmLength += ZoomDelta;
CurrentZoomTimer -= DeltaTime; CurrentZoomTimer -= DeltaTime;
//UE_LOG(LogTemp, Warning, TEXT("Zooming in: ZoomDelta:%f"), ZoomDelta); UE_LOG(LogTemp, Warning, TEXT("Zooming in: ZoomDelta:%f"), ZoomDelta);
} }
} }
@@ -173,20 +168,6 @@ FVector AMyCharacter::GetCameraWorldPosition() {
return CameraLocation; return CameraLocation;
} }
FVector AMyCharacter::GetCameraForwardVector() {
FVector CameraLocation;
FRotator CameraRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(CameraLocation, CameraRotation);
return CameraRotation.Quaternion().GetForwardVector();
}
FRotator AMyCharacter::GetCameraRotation() {
FVector CameraLocation;
FRotator CameraRotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(CameraLocation, CameraRotation);
return CameraRotation;
}
void AMyCharacter::ToggleBook(bool bOpen) void AMyCharacter::ToggleBook(bool bOpen)
{ {
if (!IsValid(BookActor)) return; if (!IsValid(BookActor)) return;
@@ -221,7 +202,6 @@ void AMyCharacter::OnHarvestSeed_Implementation(class UItem* HarvestedItem)
{ {
} }
void AMyCharacter::ZoomCamera(float CameraZoomAmount, float Time) void AMyCharacter::ZoomCamera(float CameraZoomAmount, float Time)
{ {
CurrentZoomTimer = Time; CurrentZoomTimer = Time;
@@ -230,33 +210,12 @@ void AMyCharacter::ZoomCamera(float CameraZoomAmount, float Time)
} }
void AMyCharacter::ZoomBack(float Time) { void AMyCharacter::ZoomBack(float Time) {
ZoomCamera(-(DefaultCameraZoom - CameraRef->DesiredZoom), Time); ZoomCamera(SpringArmRef->TargetArmLength - DefaultZoom, Time);
} }
void AMyCharacter::ReturnCameraToPlayer() { void AMyCharacter::ReturnCameraToPlayer() {
FTargetVector UseActorLocation; SpringArmRef->TargetArmLength = DefaultZoom;
UseActorLocation.TargetMod = TargetMod_Actor; PlayerController->SetViewTargetWithBlend(this, 0.5f);
FTargetFloat UseActorValue;
UseActorValue.TargetMod = TargetMod_Actor;
FTargetFloat UseCustomValue;
UseCustomValue.TargetMod = TargetMod_CustomValue;
UseCustomValue.FloatValue = DefaultCameraZoom;
FTravelSpeedSettings UseDuration;
UseDuration.UseSpeed = false;
UseDuration.Duration = 0.2f;
FTargetSettings UseActor;
UseActor.Actor = this;
FTargetFloat UsePitchValue;
UsePitchValue.TargetMod = TargetMod_CustomValue;
UsePitchValue.FloatValue = -40.f;
if (UAsyncNode* Node = UAsyncNode::CameraTravel(CameraRef, UseActor, UseActorLocation, FOffsetSettings(), UseActorValue, UsePitchValue, UseActorValue, UseCustomValue, nullptr, UseDuration, false, true, true)) {
Node->OnReachedDestination.AddUniqueDynamic(this, &AMyCharacter::CameraStartFollowPlayer);
}
}
void AMyCharacter::CameraStartFollowPlayer() {
CameraRef->FollowTarget(AUniversalCamera::UseActor(this), FConstrainVector2(), FBoolRotation());
} }
void AMyCharacter::SetSaveableTagData(FGameplayTag Tag, int32 NewValue) { void AMyCharacter::SetSaveableTagData(FGameplayTag Tag, int32 NewValue) {
@@ -369,7 +328,7 @@ void AMyCharacter::BeginWatering()
{ {
const FAttachmentTransformRules AttachRules = FAttachmentTransformRules(EAttachmentRule::KeepRelative, false); const FAttachmentTransformRules AttachRules = FAttachmentTransformRules(EAttachmentRule::KeepRelative, false);
WaterBallSpawned->AttachToComponent(Cast<USceneComponent>(this->GetComponentByClass(USceneComponent::StaticClass())), AttachRules); WaterBallSpawned->AttachToComponent(Cast<USceneComponent>(this->GetComponentByClass(USceneComponent::StaticClass())), AttachRules);
WaterBallSpawned->SetActorLocation(GetActorLocation() + (CameraRef->GetActorForwardVector() * 100.f) + (GetActorRightVector() * 200.f)); WaterBallSpawned->SetActorLocation(GetActorLocation() + (CameraRef->GetForwardVector() * 100.f) + (GetActorRightVector() * 200.f));
WaterBallSpawned->BeginAnimating(); WaterBallSpawned->BeginAnimating();
} }
} }

View File

@@ -26,7 +26,6 @@ public class ProjectEleri : ModuleRules
"Json", "Json",
"JsonUtilities", "JsonUtilities",
"GameplayTasks", "GameplayTasks",
"UniversalCameraPlugin",
"StateTreeModule", "StateTreeModule",
"GameplayStateTreeModule", "GameplayStateTreeModule",
"DirectiveUtilitiesRuntime", "DirectiveUtilitiesRuntime",

View File

@@ -11,8 +11,6 @@
#include "../System/Subsystem/ObjectPersistenceSubsystem.h" #include "../System/Subsystem/ObjectPersistenceSubsystem.h"
#include "Interface/SaveableObjectInterface.h" #include "Interface/SaveableObjectInterface.h"
#include "ProjectEleri/GameEventSystem/GameEventSubsystem.h" #include "ProjectEleri/GameEventSystem/GameEventSubsystem.h"
#include "AttributeSet.h"
#include "GameplayEffect.h"
#include "Data/GameplayStatEffect.h" #include "Data/GameplayStatEffect.h"
#include "Data/StatForgeDefs.h" #include "Data/StatForgeDefs.h"
#include "ProjectEleri/System/TimeOfDayStruct.h" #include "ProjectEleri/System/TimeOfDayStruct.h"

View File

@@ -11,11 +11,11 @@
#include "GlobalEnums.h" #include "GlobalEnums.h"
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "Delegates/Delegate.h" #include "Delegates/Delegate.h"
#include "AbilitySystemInterface.h"
#include "ProjectEleri/Public/Interface/SaveableObjectInterface.h" #include "ProjectEleri/Public/Interface/SaveableObjectInterface.h"
#include "MyCharacter.generated.h" #include "MyCharacter.generated.h"
class USpringArmComponent;
class UStatForgeComponent; class UStatForgeComponent;
class AEleriPlayerController; class AEleriPlayerController;
class AWaterBall; class AWaterBall;
@@ -75,14 +75,16 @@ protected:
UStatForgeComponent* StatForgeComponent; UStatForgeComponent* StatForgeComponent;
UPROPERTY() UPROPERTY()
TObjectPtr<AUniversalCamera> CameraRef; TObjectPtr<UCameraComponent> CameraRef;
UPROPERTY()
TObjectPtr<USpringArmComponent> SpringArmRef;
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess))
float DefaultZoom = 2000.f;
float CurrentZoomTimer = 0.f; float CurrentZoomTimer = 0.f;
float ZoomTime = 0.f; float ZoomTime = 0.f;
float NextZoomOffsetTarget = 0.f; float NextZoomOffsetTarget = 0.f;
float DefaultZoom = 0.f;
UFUNCTION()
void CameraStartFollowPlayer();
//----- ISaveableObjectInterface ----- //----- ISaveableObjectInterface -----
// This is so actors can have custom data and we don't need to create new classes for it // This is so actors can have custom data and we don't need to create new classes for it
@@ -116,9 +118,6 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<AWaterBall> WaterBallClass; TSubclassOf<AWaterBall> WaterBallClass;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<AUniversalCamera> CameraClass;
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
bool bIsWatering; bool bIsWatering;
UPROPERTY(BlueprintReadOnly, EditAnywhere) UPROPERTY(BlueprintReadOnly, EditAnywhere)
@@ -148,24 +147,15 @@ public:
UFUNCTION(BlueprintCallable, Category = "Camera Controll") UFUNCTION(BlueprintCallable, Category = "Camera Controll")
void ReturnCameraToPlayer(); void ReturnCameraToPlayer();
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
float DefaultCameraZoom = 0.f;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void SetNewCameraPitches(float NewMinPitch, float NewMaxPitch); void SetNewCameraPitches(float NewMinPitch, float NewMaxPitch);
UFUNCTION(BlueprintCallable, BlueprintPure) UFUNCTION(BlueprintCallable, BlueprintPure)
FORCEINLINE AUniversalCamera* GetPlayerCamera() { return CameraRef; } FORCEINLINE UCameraComponent* GetPlayerCamera() { return CameraRef; }
UFUNCTION(BlueprintCallable, BlueprintPure) UFUNCTION(BlueprintCallable, BlueprintPure)
FVector GetCameraWorldPosition(); FVector GetCameraWorldPosition();
UFUNCTION(BlueprintCallable, BlueprintPure)
FVector GetCameraForwardVector();
UFUNCTION(BlueprintCallable, BlueprintPure)
FRotator GetCameraRotation();
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void ToggleBook(bool bOpen); void ToggleBook(bool bOpen);