diff --git a/.gitignore b/.gitignore index f4334a5..ee51d82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +# Custom ignores +**/cmake-build-debug/** +.idea +out +build +CMakeLists.txt + +# Default UE4 generated .ignores Binaries DerivedDataCache Intermediate @@ -11,4 +19,4 @@ Saved *.sln *.suo *.xcodeproj -*.xcworkspace \ No newline at end of file +*.xcworkspace diff --git a/Config/DefaultGame.ini b/Config/DefaultGame.ini index 62ea7e1..4ddd86f 100644 --- a/Config/DefaultGame.ini +++ b/Config/DefaultGame.ini @@ -1,7 +1,10 @@ [/Script/EngineSettings.GeneralProjectSettings] ProjectID=467E2A14A3B54EB78FE52E4DC9F8CBE4 ProjectName=Third Person BP Game Template +CopyrightNotice=All content (c) Shaun Reed 2021, all rights reserved +LicensingTerms=MIT [StartupActions] bAddPacks=True InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent") + diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index 202fad6..774c29b 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -1,5 +1,20 @@ + [/Script/Engine.InputSettings] +-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) +-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) +-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) +-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) ++AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) @@ -90,12 +105,6 @@ +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Touch",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) +AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) -+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) -+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) -+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) -+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) -+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) -+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) bAltEnterTogglesFullscreen=True bF11TogglesFullscreen=True bUseMouseForTouch=False @@ -131,6 +140,8 @@ DoubleClickTime=0.200000 +ActionMappings=(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouch_Left_Thumbstick_Click) +ActionMappings=(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=ValveIndex_Left_Thumbstick_Click) +ActionMappings=(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MagicLeap_Left_Bumper) ++ActionMappings=(ActionName="SpawnActors",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=One) ++ActionMappings=(ActionName="DestroyActors",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Two) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W) +AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Up) @@ -163,7 +174,9 @@ DoubleClickTime=0.200000 +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=OculusTouch_Left_Thumbstick_X) +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=ValveIndex_Left_Thumbstick_X) +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=MagicLeap_Left_Trackpad_X) +DefaultPlayerInputClass=/Script/Engine.PlayerInput +DefaultInputComponentClass=/Script/Engine.InputComponent DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks +-ConsoleKeys=Tilde +ConsoleKeys=Tilde - diff --git a/Content/MyAssets/Blueprints/Bp_ActorSpawner.uasset b/Content/MyAssets/Blueprints/Bp_ActorSpawner.uasset new file mode 100644 index 0000000..0e00447 Binary files /dev/null and b/Content/MyAssets/Blueprints/Bp_ActorSpawner.uasset differ diff --git a/Content/MyAssets/Blueprints/Bp_BallActor.uasset b/Content/MyAssets/Blueprints/Bp_BallActor.uasset new file mode 100644 index 0000000..ed6a9e2 Binary files /dev/null and b/Content/MyAssets/Blueprints/Bp_BallActor.uasset differ diff --git a/Content/MyAssets/Blueprints/Bp_SpawnActor.uasset b/Content/MyAssets/Blueprints/Bp_SpawnActor.uasset new file mode 100644 index 0000000..dc79349 Binary files /dev/null and b/Content/MyAssets/Blueprints/Bp_SpawnActor.uasset differ diff --git a/Content/ThirdPersonBP/Blueprints/ThirdPersonCharacter.uasset b/Content/ThirdPersonBP/Blueprints/ThirdPersonCharacter.uasset index 17afb32..b98bf9b 100644 Binary files a/Content/ThirdPersonBP/Blueprints/ThirdPersonCharacter.uasset and b/Content/ThirdPersonBP/Blueprints/ThirdPersonCharacter.uasset differ diff --git a/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap b/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap index 8fabc2d..6d1ad98 100644 Binary files a/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap and b/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap differ diff --git a/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap_BuiltData.uasset b/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap_BuiltData.uasset index f4f30b7..1052bbe 100644 Binary files a/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap_BuiltData.uasset and b/Content/ThirdPersonBP/Maps/ThirdPersonExampleMap_BuiltData.uasset differ diff --git a/Source/ThirdPerson.Target.cs b/Source/ThirdPerson.Target.cs new file mode 100644 index 0000000..3f9e060 --- /dev/null +++ b/Source/ThirdPerson.Target.cs @@ -0,0 +1,15 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +using UnrealBuildTool; +using System.Collections.Generic; + +public class ThirdPersonTarget : TargetRules +{ + public ThirdPersonTarget(TargetInfo Target) : base(Target) + { + Type = TargetType.Game; + DefaultBuildSettings = BuildSettingsVersion.V2; + + ExtraModuleNames.AddRange( new string[] { "ThirdPerson" } ); + } +} diff --git a/Source/ThirdPerson/Private/ActorSpawner.cpp b/Source/ThirdPerson/Private/ActorSpawner.cpp new file mode 100644 index 0000000..a145345 --- /dev/null +++ b/Source/ThirdPerson/Private/ActorSpawner.cpp @@ -0,0 +1,40 @@ +// All content (c) Shaun Reed 2021, all rights reserved + + +#include "ActorSpawner.h" +// Include the header file from the actor we want to spawn +#include "BallActor.h" + +// Engine includes +#include "Components/BoxComponent.h" + +// Sets default values +AActorSpawner::AActorSpawner() +{ + RootComponent = CreateDefaultSubobject(TEXT("DefaultSceneRoot")); + SpawnVolume = CreateDefaultSubobject(TEXT("SpawnVolume")); + SpawnVolume->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform); +} + +void AActorSpawner::SpawnActor() +{ + // Get initial position and rotation, then spawn the actor + FVector SpawnLocation = GetActorLocation(); + FRotator SpawnRotation = GetActorRotation(); + GetWorld()->SpawnActor(SpawnLocation, SpawnRotation); +} + +// Called when the game starts or when spawned +void AActorSpawner::BeginPlay() +{ + Super::BeginPlay(); + +} + +// Called every frame +void AActorSpawner::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/Source/ThirdPerson/Private/BallActor.cpp b/Source/ThirdPerson/Private/BallActor.cpp new file mode 100644 index 0000000..e6b8165 --- /dev/null +++ b/Source/ThirdPerson/Private/BallActor.cpp @@ -0,0 +1,60 @@ +// All content (c) Shaun Reed 2021, all rights reserved + + +#include "BallActor.h" + + +#include "Components/SphereComponent.h" +#include "Particles/ParticleSystemComponent.h" + +// Sets default values +ABallActor::ABallActor() +{ + // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. + PrimaryActorTick.bCanEverTick = true; + + + // Attach a sphere with the name 'Sphere' + SphereComp = CreateDefaultSubobject(TEXT("Sphere")); + // Attach a static mesh component with the name 'MeshComp'; etc.. + StaticMeshComp = CreateDefaultSubobject(TEXT("MeshComp")); + ParticleComp = CreateDefaultSubobject(TEXT("ParticleComp")); + + // Attach the sphere to the root position of this Actor and configure settings + SphereComp->SetupAttachment(RootComponent); + SphereComp->SetSimulatePhysics(true); + SphereComp->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics); + + // Attach the static mesh to the sphere + StaticMeshComp->AttachToComponent(SphereComp, FAttachmentTransformRules::KeepRelativeTransform); + // Attach the particle system to the static mesh + ParticleComp->AttachToComponent(StaticMeshComp, FAttachmentTransformRules::KeepRelativeTransform); + + // Set sphere radius to be smaller size in line with the static mesh (?) + SphereComp->SetSphereRadius(16.0f * this->sizeScale); + + StaticMeshComp->SetRelativeLocation(FVector(0.0f, 0.0f, -12.0f)); + StaticMeshComp->SetRelativeScale3D(FVector(0.25f, 0.25f, 0.25f)); + + static ConstructorHelpers::FObjectFinderSphereMeshAsset(TEXT("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'")); + StaticMeshComp->SetStaticMesh(SphereMeshAsset.Object); + + static ConstructorHelpers::FObjectFinderParticleCompAsset(TEXT("ParticleSystem'/Game/StarterContent/Particles/P_Fire.P_Fire'")); + ParticleComp->SetTemplate(ParticleCompAsset.Object); +} + +// Called when the game starts or when spawned +void ABallActor::BeginPlay() +{ + Super::BeginPlay(); + + +} + +// Called every frame +void ABallActor::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + +} + diff --git a/Source/ThirdPerson/Public/ActorSpawner.h b/Source/ThirdPerson/Public/ActorSpawner.h new file mode 100644 index 0000000..12fca68 --- /dev/null +++ b/Source/ThirdPerson/Public/ActorSpawner.h @@ -0,0 +1,31 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "ActorSpawner.generated.h" + +UCLASS(Blueprintable) +class THIRDPERSON_API AActorSpawner : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + AActorSpawner(); + + UFUNCTION(BlueprintCallable, Category = "Spawn") + void SpawnActor(); + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + class UBoxComponent* SpawnVolume; +public: + // Called every frame + virtual void Tick(float DeltaTime) override; + +}; diff --git a/Source/ThirdPerson/Public/BallActor.h b/Source/ThirdPerson/Public/BallActor.h new file mode 100644 index 0000000..d0b7f2f --- /dev/null +++ b/Source/ThirdPerson/Public/BallActor.h @@ -0,0 +1,37 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "BallActor.generated.h" + +UCLASS() +class THIRDPERSON_API ABallActor : public AActor +{ + GENERATED_BODY() + +public: + // Sets default values for this actor's properties + ABallActor(); + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + float sizeScale = 1.0; + +protected: + // Called when the game starts or when spawned + virtual void BeginPlay() override; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + class USphereComponent* SphereComp; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + UStaticMeshComponent* StaticMeshComp; + + UPROPERTY(EditAnywhere, BlueprintReadWrite) + class UParticleSystemComponent* ParticleComp; + +public: + // Called every frame + virtual void Tick(float DeltaTime) override; +}; diff --git a/Source/ThirdPerson/ThirdPerson.Build.cs b/Source/ThirdPerson/ThirdPerson.Build.cs new file mode 100644 index 0000000..1a15cc4 --- /dev/null +++ b/Source/ThirdPerson/ThirdPerson.Build.cs @@ -0,0 +1,23 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +using UnrealBuildTool; + +public class ThirdPerson : ModuleRules +{ + public ThirdPerson(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + + PrivateDependencyModuleNames.AddRange(new string[] { }); + + // Uncomment if you are using Slate UI + // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); + + // Uncomment if you are using online features + // PrivateDependencyModuleNames.Add("OnlineSubsystem"); + + // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true + } +} diff --git a/Source/ThirdPerson/ThirdPerson.cpp b/Source/ThirdPerson/ThirdPerson.cpp new file mode 100644 index 0000000..b71fc01 --- /dev/null +++ b/Source/ThirdPerson/ThirdPerson.cpp @@ -0,0 +1,6 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +#include "ThirdPerson.h" +#include "Modules/ModuleManager.h" + +IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, ThirdPerson, "ThirdPerson" ); diff --git a/Source/ThirdPerson/ThirdPerson.h b/Source/ThirdPerson/ThirdPerson.h new file mode 100644 index 0000000..333273d --- /dev/null +++ b/Source/ThirdPerson/ThirdPerson.h @@ -0,0 +1,6 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +#pragma once + +#include "CoreMinimal.h" + diff --git a/Source/ThirdPersonEditor.Target.cs b/Source/ThirdPersonEditor.Target.cs new file mode 100644 index 0000000..f9f53b3 --- /dev/null +++ b/Source/ThirdPersonEditor.Target.cs @@ -0,0 +1,15 @@ +// All content (c) Shaun Reed 2021, all rights reserved + +using UnrealBuildTool; +using System.Collections.Generic; + +public class ThirdPersonEditorTarget : TargetRules +{ + public ThirdPersonEditorTarget(TargetInfo Target) : base(Target) + { + Type = TargetType.Editor; + DefaultBuildSettings = BuildSettingsVersion.V2; + + ExtraModuleNames.AddRange( new string[] { "ThirdPerson" } ); + } +} diff --git a/ThirdPerson.uproject b/ThirdPerson.uproject index 3251f44..ba409a7 100644 --- a/ThirdPerson.uproject +++ b/ThirdPerson.uproject @@ -2,5 +2,15 @@ "FileVersion": 3, "EngineAssociation": "4.27", "Category": "", - "Description": "" + "Description": "", + "Modules": [ + { + "Name": "ThirdPerson", + "Type": "Runtime", + "LoadingPhase": "Default", + "AdditionalDependencies": [ + "Engine" + ] + } + ] } \ No newline at end of file