diff --git a/Docs/DevelopmentLog.md b/Docs/DevelopmentLog.md index 69f472c..bbd7463 100644 --- a/Docs/DevelopmentLog.md +++ b/Docs/DevelopmentLog.md @@ -2,6 +2,32 @@ Kept up to date with notes from latest meetings +## 3. Meeting with Tilo 09/11/17, 2pm Tilo's Office + +Not present: +* David + +Notes by Nick + +General Notes: +* IK driving physics will be difficult but is worth us persuing +* Asked for a windows machine to be made availible for development use +* Requested ports to be opened (they may be only opened on certain rows) +* Need a proper prototype test map +* Need to ensure we are integrating our work regularly +* Tilo wants us to consider the idea of a custom controller, also to think about our third key technology + +__Group meeting after:__ + +New Tasks: +* Set up a system so we can have constraints along the arms so that the arms can support the body in ragdoll +* Research combining physics with IK - what works by default in unreal +* Writing a custom IK solver +* Using a sphere trace around the player to maintain a list of possible IK targets +* Sort function that can take a large list of input points and choose IK targets for left and right hands from the list based + +Plan to meet again on Monday + ## 2. Meeting 06/11/17, 1pm MVB Not present: diff --git a/ParkourGame/Content/ThirdPersonCPP/Blueprints/NoCharacterGameMode.uasset b/ParkourGame/Content/ThirdPersonCPP/Blueprints/NoCharacterGameMode.uasset index 3310ffd..7a0781e 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Blueprints/NoCharacterGameMode.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Blueprints/NoCharacterGameMode.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c775924b09ddab4880c32ca8aebd7118777b1c95f46e212adb267cd6c5d38adf -size 17873 +oid sha256:2ad812c7c1cc150e5bbaa3bc1cb9fd0d123b3d8d6d69beb89a10597706341d57 +size 18275 diff --git a/ParkourGame/Content/ThirdPersonCPP/Blueprints/WidgetConnectionScreen.uasset b/ParkourGame/Content/ThirdPersonCPP/Blueprints/WidgetConnectionScreen.uasset index 52f59d3..5edf6d1 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Blueprints/WidgetConnectionScreen.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Blueprints/WidgetConnectionScreen.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95a11462dbf0f2656f63318590098f67620c2b93719534a8106f48ec84b96445 -size 52420 +oid sha256:918b93d2033a314f9a9601ab0d49b8e9bd25e0733453e222e78a96b9ab41dd19 +size 65627 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap_BuiltData.uasset b/ParkourGame/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap_BuiltData.uasset index 8f4d46a..50ecda7 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap_BuiltData.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap_BuiltData.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8600fe5c9d4eaccd37863e9c802fccbb40ed8119ef5aa4432e182b45535459ab -size 2911551 +oid sha256:a51cf186239eca26e9382eabef16a997f752c85c44a43fd944c10b74f312a99f +size 2911555 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap.umap b/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap.umap index d154a0e..2b4ced9 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap.umap +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5cc6118ba1b6abcc861803fd6aea691f12cb97c323ab1c0f3e3784844e9abcd4 -size 42252 +oid sha256:df6fcac905668198c48ac22766f3bb35a8668a5035b0f4e9367485b623668776 +size 36276 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap_BuiltData.uasset b/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap_BuiltData.uasset index 0c16aca..80e31bf 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap_BuiltData.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/entryMap_BuiltData.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3474667e0669468e356b86cd37cdb8624dc5b2455a3fd64322e9ce56dc8ade9f -size 3177224 +oid sha256:a22fd82ae5f77fbc1ba6f1364ecf9eaeb98e8790f58267c38677692e9d6fc8c8 +size 21539 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel.umap b/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel.umap index 4bea4f4..a8c76d7 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel.umap +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9ff5b62d75714dfddd4db04ab9c10a50f1cd130684e433582949e7eb027a2161 -size 8524661 +oid sha256:85e6b79c5b683e5861d4953de22ddbadc5b556b28b132abc86ab7ad2f7ab61c9 +size 8956381 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel_BuiltData.uasset b/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel_BuiltData.uasset index 4be9dd9..c96c5c6 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel_BuiltData.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/testLevel_BuiltData.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f3f24c15f0a2d5d471424d08dd7f0a27973b791329676cdbbc92dd705f9c388 -size 3162310 +oid sha256:f95cb3afc98c4a6256259c513a2609ca20e40c2e122d4b0b6e18ea600e5d290f +size 3272877 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap.umap b/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap.umap index e05b35c..c610748 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap.umap +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63bb3c58f95d95c42fd287a54e46038594ab397a74e7aba633d09f13723eee3f -size 36388 +oid sha256:f5ebcb74dfd60b3a2db1ecf6edfc75d8e08e5f145d508e868eac3db3d4636e2e +size 36461 diff --git a/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap_BuiltData.uasset b/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap_BuiltData.uasset index 4d2c16c..c931d76 100644 --- a/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap_BuiltData.uasset +++ b/ParkourGame/Content/ThirdPersonCPP/Maps/transitionMap_BuiltData.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a751ad5e8f5050a0ed7730a19d8c33200ab54d90ae1f352bbf1b7344cfa25078 -size 3171146 +oid sha256:41abcee265ad3b04e745bf7e89af7e0f9f004bd8da796c9769678b304d8751a5 +size 3171150 diff --git a/ParkourGame/ParkourGame.uproject b/ParkourGame/ParkourGame.uproject index d58c12e..96fd7c0 100644 --- a/ParkourGame/ParkourGame.uproject +++ b/ParkourGame/ParkourGame.uproject @@ -1,13 +1,16 @@ { "FileVersion": 3, - "EngineAssociation": "4.17", + "EngineAssociation": "4.18", "Category": "", "Description": "", "Modules": [ { "Name": "ParkourGame", "Type": "Runtime", - "LoadingPhase": "Default" + "LoadingPhase": "Default", + "AdditionalDependencies": [ + "Engine" + ] } ], "TargetPlatforms": [ @@ -15,4 +18,4 @@ "MacNoEditor", "WindowsNoEditor" ] -} +} \ No newline at end of file diff --git a/ParkourGame/Source/ParkourGame/ParkourGameCharacter.cpp b/ParkourGame/Source/ParkourGame/ParkourGameCharacter.cpp index 65d5ccb..9d601ad 100644 --- a/ParkourGame/Source/ParkourGame/ParkourGameCharacter.cpp +++ b/ParkourGame/Source/ParkourGame/ParkourGameCharacter.cpp @@ -1,6 +1,10 @@ // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "ParkourGameCharacter.h" + +#include "Private/Physics/ConstraintManager.h" + +// Engine #include "HeadMountedDisplayFunctionLibrary.h" #include "Camera/CameraComponent.h" #include "Components/CapsuleComponent.h" @@ -45,6 +49,8 @@ AParkourGameCharacter::AParkourGameCharacter() // Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character) // are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++) + + ConstraintManager = CreateDefaultSubobject(TEXT("ConstraintManager")); } ////////////////////////////////////////////////////////////////////////// diff --git a/ParkourGame/Source/ParkourGame/ParkourGameCharacter.h b/ParkourGame/Source/ParkourGame/ParkourGameCharacter.h index da7db82..e581b4f 100644 --- a/ParkourGame/Source/ParkourGame/ParkourGameCharacter.h +++ b/ParkourGame/Source/ParkourGame/ParkourGameCharacter.h @@ -18,6 +18,9 @@ class AParkourGameCharacter : public ACharacter /** Follow camera */ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) class UCameraComponent* FollowCamera; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) + class UConstraintManager* ConstraintManager; public: AParkourGameCharacter(); diff --git a/ParkourGame/Source/ParkourGame/Private/Physics/ConstraintManager.cpp b/ParkourGame/Source/ParkourGame/Private/Physics/ConstraintManager.cpp new file mode 100644 index 0000000..db6fc70 --- /dev/null +++ b/ParkourGame/Source/ParkourGame/Private/Physics/ConstraintManager.cpp @@ -0,0 +1,95 @@ +#include "ConstraintManager.h" + +#include "PhysicsEngine/PhysicsConstraintActor.h" +#include "PhysicsEngine/PhysicsConstraintComponent.h" + + +// Sets default values for this component's properties +UConstraintManager::UConstraintManager() +{ + // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features + // off to improve performance if you don't need them. + PrimaryComponentTick.bCanEverTick = false; +} + + +// Called when the game starts +void UConstraintManager::BeginPlay() +{ + Super::BeginPlay(); + + +} + +FGuid UConstraintManager::CreateConstraint(const FName& Bone, UPrimitiveComponent* OtherComp, const FName& OtherBone /*= NAME_None*/) +{ + UWorld* WorldPtr = GetWorld(); + + if (!OtherComp || Bone == NAME_None || !WorldPtr) + return FGuid(); + + // Create constraint comp + USkeletalMeshComponent* SkelMeshComp = GetSkeletalMeshComp(); + UPhysicsConstraintComponent* NewConstraintComp = NewObject(OtherComp->GetOwner()); + + if (!ensure(NewConstraintComp) || !ensure(SkelMeshComp)) + return FGuid(); + + // Setup the constraint actor + FConstraintInstance ConstraintInstance; + NewConstraintComp->ConstraintInstance = ConstraintInstance; + + NewConstraintComp->SetWorldLocation(OtherComp->GetOwner()->GetActorLocation()); + NewConstraintComp->AttachToComponent (OtherComp, FAttachmentTransformRules::KeepWorldTransform, OtherBone); + NewConstraintComp->SetConstrainedComponents(OtherComp, OtherBone, SkelMeshComp, Bone); + + // @TODO : Bind to constraint broken event and handle that case + + // Add to our list of managed constraints + FManagedPhysicsConstraint& NewConstraint = m_ActiveConstraints[m_ActiveConstraints.AddDefaulted()]; + + NewConstraint.ConstraintID.NewGuid(); + NewConstraint.ConstraintComp = NewConstraintComp; + NewConstraint.TargetBone = Bone; + NewConstraint.OtherComp = OtherComp; + NewConstraint.OtherBone = OtherBone; + + return NewConstraint.ConstraintID; +} + +void UConstraintManager::DestroyConstraint(const FGuid& Constraint) +{ + int32 RemoveIndex = m_ActiveConstraints.FindLastByPredicate([&](const FManagedPhysicsConstraint& QueryConstraint) { + return QueryConstraint.ConstraintID == Constraint; + }); + + if (RemoveIndex == INDEX_NONE) + return; + + UPhysicsConstraintComponent* ConstraintCompPtr = m_ActiveConstraints[RemoveIndex].ConstraintComp.Get(); + + if (ConstraintCompPtr) + { + // @TODO Unbind from constrain broken event + ConstraintCompPtr->BreakConstraint(); + ConstraintCompPtr->DestroyComponent(); + } + + m_ActiveConstraints.RemoveAtSwap(RemoveIndex); +} + +void UConstraintManager::GetConstraintByTargetBone(const FName& Bone, TArray& outConstraints) const +{ + GetConstraintsByPredicate([&](const FManagedPhysicsConstraint& Constraint) { + return Constraint.TargetBone == Bone; + }, outConstraints); +} + +USkeletalMeshComponent* UConstraintManager::GetSkeletalMeshComp() +{ + USkeletalMeshComponent* CompPtr = m_SkeletalMeshComp.Get(); + + if (CompPtr) return CompPtr; + + return Cast(GetOwner()->GetComponentByClass(USkeletalMeshComponent::StaticClass())); +} diff --git a/ParkourGame/Source/ParkourGame/Private/Physics/ConstraintManager.h b/ParkourGame/Source/ParkourGame/Private/Physics/ConstraintManager.h new file mode 100644 index 0000000..937ec18 --- /dev/null +++ b/ParkourGame/Source/ParkourGame/Private/Physics/ConstraintManager.h @@ -0,0 +1,67 @@ +#pragma once + +#include "CoreMinimal.h" +#include "Components/ActorComponent.h" +#include "ConstraintManager.generated.h" + + +// @TODO: have a lookup table of constraint profile data we can reference for different situations + +//typedef FGuid FConstraintID; + +class UPhysicsConstraintComponent; + +struct FManagedPhysicsConstraint +{ +public: + FGuid ConstraintID; + + TWeakObjectPtr ConstraintComp; + + FName TargetBone = NAME_None; + + TWeakObjectPtr OtherComp; + FName OtherBone = NAME_None; +}; + + +UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) +class UConstraintManager : public UActorComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UConstraintManager(); + + // Called when the game starts + virtual void BeginPlay() override; + +public: + + UFUNCTION(BlueprintCallable, Category = "ConstraintManager", meta = (AutoCreateRefTerm="Bone,OtherBone")) + FGuid CreateConstraint(const FName& Bone, UPrimitiveComponent* OtherComp, const FName& OtherBone = NAME_None); + + UFUNCTION(BlueprintCallable, Category = "ConstraintManager") + void DestroyConstraint(const FGuid& Constraint); + + template + void GetConstraintsByPredicate(Func Predicate, TArray& outConstraints) const + { + for (const FManagedPhysicsConstraint& Constraint : m_ActiveConstraints) + { + if (Predicate(Constraint)) + outConstraints.Add(Constraint.ConstraintID); + } + } + + UFUNCTION(BlueprintCallable, Category = "ConstraintManager", meta = (AutoCreateRefTerm="Bone")) + void GetConstraintByTargetBone(const FName& Bone, TArray& outConstraints) const; + +private: + + USkeletalMeshComponent* GetSkeletalMeshComp(); + + TWeakObjectPtr m_SkeletalMeshComp; + TArray m_ActiveConstraints; +}; diff --git a/ParkourGame/Source/ParkourGame/Private/Utils/ParkourGameLogging.cpp b/ParkourGame/Source/ParkourGame/Private/Utils/ParkourGameLogging.cpp new file mode 100644 index 0000000..d78d50f --- /dev/null +++ b/ParkourGame/Source/ParkourGame/Private/Utils/ParkourGameLogging.cpp @@ -0,0 +1,3 @@ +#include "ParkourGameLogging.h" + +DEFINE_LOG_CATEGORY(ParkourGame); \ No newline at end of file diff --git a/ParkourGame/Source/ParkourGame/Public/Utils/GameVersion.h b/ParkourGame/Source/ParkourGame/Public/Utils/GameVersion.h index 87c7643..be0bf8e 100644 --- a/ParkourGame/Source/ParkourGame/Public/Utils/GameVersion.h +++ b/ParkourGame/Source/ParkourGame/Public/Utils/GameVersion.h @@ -5,8 +5,8 @@ #include "GameVersion.generated.h" #define GAME_VERSION_MAJOR 0 -#define GAME_VERSION_MINOR 1 -#define GAME_VERSION_PATCH 0 +#define GAME_VERSION_MINOR 2 +#define GAME_VERSION_PATCH 1 USTRUCT(BlueprintType) struct FGameVersion diff --git a/ParkourGame/Source/ParkourGame/Public/Utils/ParkourGameLogging.h b/ParkourGame/Source/ParkourGame/Public/Utils/ParkourGameLogging.h new file mode 100644 index 0000000..4f82ccf --- /dev/null +++ b/ParkourGame/Source/ParkourGame/Public/Utils/ParkourGameLogging.h @@ -0,0 +1,5 @@ +#pragma once + +#include "CoreMinimal.h" + +DECLARE_LOG_CATEGORY_EXTERN(ParkourGame, Log, All); \ No newline at end of file