From 1792211f19473865afbd8d98dd96b292a8b2ca7d Mon Sep 17 00:00:00 2001
From: David Gilbert <gilbert@vr.rwth-aachen.de>
Date: Mon, 30 Oct 2023 14:27:15 +0100
Subject: [PATCH] refactor(navigation): Moves navigation related components in
 respective folder

---
 .../ContinuousMovementComponent.cpp           |   2 +-
 .../MovementComponentBase.cpp                 |   2 +-
 .../TeleportationComponent.cpp                |   2 +-
 .../Private/Pawn/VRPawnMovement.cpp           |   2 +-
 .../Private/Pawn/VirtualRealityPawn.cpp       |   4 +-
 .../ContinuousMovementComponent.h             |   2 +-
 .../Pawn/Navigation}/MovementComponentBase.h  |   0
 .../{ => Navigation}/TeleportationComponent.h |   2 +-
 .../Pawn/{ => Navigation}/VRPawnMovement.h    | 174 +++++++++---------
 .../Public/Pawn/VirtualRealityPawn.h          |   2 +-
 10 files changed, 96 insertions(+), 96 deletions(-)
 rename Source/RWTHVRToolkit/Private/Pawn/{ => Navigation}/ContinuousMovementComponent.cpp (97%)
 rename Source/RWTHVRToolkit/Private/Pawn/{ => Navigation}/MovementComponentBase.cpp (98%)
 rename Source/RWTHVRToolkit/Private/Pawn/{ => Navigation}/TeleportationComponent.cpp (99%)
 rename Source/RWTHVRToolkit/Public/Pawn/{ => Navigation}/ContinuousMovementComponent.h (97%)
 rename Source/RWTHVRToolkit/{Private/Pawn => Public/Pawn/Navigation}/MovementComponentBase.h (100%)
 rename Source/RWTHVRToolkit/Public/Pawn/{ => Navigation}/TeleportationComponent.h (98%)
 rename Source/RWTHVRToolkit/Public/Pawn/{ => Navigation}/VRPawnMovement.h (97%)

diff --git a/Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp
similarity index 97%
rename from Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp
rename to Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp
index 787b9c1a..9843a159 100644
--- a/Source/RWTHVRToolkit/Private/Pawn/ContinuousMovementComponent.cpp
+++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp
@@ -1,6 +1,6 @@
 // Fill out your copyright notice in the Description page of Project Settings.
 
-#include "Pawn/ContinuousMovementComponent.h"
+#include "Pawn/Navigation/ContinuousMovementComponent.h"
 
 #include "EnhancedInputComponent.h"
 #include "EnhancedInputSubsystems.h"
diff --git a/Source/RWTHVRToolkit/Private/Pawn/MovementComponentBase.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp
similarity index 98%
rename from Source/RWTHVRToolkit/Private/Pawn/MovementComponentBase.cpp
rename to Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp
index 715cd955..2f8f319d 100644
--- a/Source/RWTHVRToolkit/Private/Pawn/MovementComponentBase.cpp
+++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp
@@ -1,7 +1,7 @@
 // Fill out your copyright notice in the Description page of Project Settings.
 
 
-#include "Pawn/MovementComponentBase.h"
+#include "Pawn/Navigation/MovementComponentBase.h"
 
 #include "EnhancedInputComponent.h"
 #include "EnhancedInputSubsystems.h"
diff --git a/Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp
similarity index 99%
rename from Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp
rename to Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp
index c760b50c..667cd7b1 100644
--- a/Source/RWTHVRToolkit/Private/Pawn/TeleportationComponent.cpp
+++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp
@@ -1,7 +1,7 @@
 // Fill out your copyright notice in the Description page of Project Settings.
 
 
-#include "Pawn/TeleportationComponent.h"
+#include "Pawn/Navigation/TeleportationComponent.h"
 
 #include "EnhancedInputComponent.h"
 #include "EnhancedInputSubsystems.h"
diff --git a/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp b/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp
index 4b4b8190..5822f34a 100644
--- a/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp
+++ b/Source/RWTHVRToolkit/Private/Pawn/VRPawnMovement.cpp
@@ -1,4 +1,4 @@
-#include "Pawn/VRPawnMovement.h"
+#include "Pawn/Navigation/VRPawnMovement.h"
 #include "DrawDebugHelpers.h"
 #include "Kismet/KismetSystemLibrary.h"
 
diff --git a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp
index 4ac07d8e..77dc2be8 100644
--- a/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp
+++ b/Source/RWTHVRToolkit/Private/Pawn/VirtualRealityPawn.cpp
@@ -10,11 +10,11 @@
 #include "Core/RWTHVRPlayerState.h"
 #include "Kismet/GameplayStatics.h"
 #include "Logging/StructuredLog.h"
-#include "Pawn/ContinuousMovementComponent.h"
+#include "Pawn/InputExtensionInterface.h"
+#include "Pawn/Navigation/VRPawnMovement.h"
 #include "Pawn/ReplicatedCameraComponent.h"
 #include "Pawn/ReplicatedMotionControllerComponent.h"
 #include "Pawn/VRPawnInputConfig.h"
-#include "Pawn/VRPawnMovement.h"
 #include "Roles/LiveLinkTransformTypes.h"
 #include "Utility/VirtualRealityUtilities.h"
 
diff --git a/Source/RWTHVRToolkit/Public/Pawn/ContinuousMovementComponent.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h
similarity index 97%
rename from Source/RWTHVRToolkit/Public/Pawn/ContinuousMovementComponent.h
rename to Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h
index 0c1daf2f..6f7d8014 100644
--- a/Source/RWTHVRToolkit/Public/Pawn/ContinuousMovementComponent.h
+++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h
@@ -4,7 +4,7 @@
 
 #include "CoreMinimal.h"
 #include "Pawn/VirtualRealityPawn.h"
-#include "Pawn/MovementComponentBase.h"
+#include "Pawn/Navigation/MovementComponentBase.h"
 #include "Components/ActorComponent.h"
 #include "ContinuousMovementComponent.generated.h"
 
diff --git a/Source/RWTHVRToolkit/Private/Pawn/MovementComponentBase.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h
similarity index 100%
rename from Source/RWTHVRToolkit/Private/Pawn/MovementComponentBase.h
rename to Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h
diff --git a/Source/RWTHVRToolkit/Public/Pawn/TeleportationComponent.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h
similarity index 98%
rename from Source/RWTHVRToolkit/Public/Pawn/TeleportationComponent.h
rename to Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h
index 9946ed94..2f07fef5 100644
--- a/Source/RWTHVRToolkit/Public/Pawn/TeleportationComponent.h
+++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h
@@ -7,7 +7,7 @@
 #include "Pawn/VirtualRealityPawn.h"
 #include "NiagaraComponent.h"
 #include "Kismet/GameplayStaticsTypes.h"
-#include "Pawn/MovementComponentBase.h"
+#include "Pawn/Navigation/MovementComponentBase.h"
 
 #include "TeleportationComponent.generated.h"
 
diff --git a/Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/VRPawnMovement.h
similarity index 97%
rename from Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h
rename to Source/RWTHVRToolkit/Public/Pawn/Navigation/VRPawnMovement.h
index 31ae483a..63dc5b0e 100644
--- a/Source/RWTHVRToolkit/Public/Pawn/VRPawnMovement.h
+++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/VRPawnMovement.h
@@ -1,87 +1,87 @@
-#pragma once
-
-#include "CoreMinimal.h"
-#include "GameFramework/FloatingPawnMovement.h"
-#include "Components/CapsuleComponent.h"
-
-#include "VRPawnMovement.generated.h"
-
-/*
- * This Movement component is needed since in VR not only the pawn itself (UpdatedComponent) is moved but also the
- * user herself can walk and thereby move the CameraComponent, which can also lead to collisions or e.g. going up steps 
- *
- * The four modes are:
- * None: No controller movement is applied and no corrections regarding steps or collisions with walls are done
- * Ghost: The same as above but now the Inputs can be used for unconstrained flying (also through objects)
- * Fly: The user can fly but not through walls etc. When the user walks against a wall the scene is moved with her to avoid walking through
- *      The user can also walk up stairs with a maximum step height of MaxStepHeight
- * Walk: Additionally to Fly now gravity keeps the user on the floor
- */
-
-UENUM(BlueprintType)
-enum class EVRNavigationModes : uint8
-{
-	NAV_NONE UMETA(DisplayName = "None (no controller movement)"),
-	NAV_GHOST UMETA(DisplayName = "Ghost (flying, also through walls)"),
-	NAV_FLY UMETA(DisplayName = "Fly (prohibiting collisions)"),
-	NAV_WALK UMETA(DisplayName = "Walk (gravity and prohibiting collisions)")
-};
-
-UCLASS()
-class RWTHVRTOOLKIT_API UVRPawnMovement : public UFloatingPawnMovement
-{
-	GENERATED_UCLASS_BODY()
-
-public:
-	virtual void BeginPlay() override;
-	void CheckAndRevertCollisionSinceLastTick();
-
-	void MoveOutOfNewDynamicCollisions();
-	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType,
-	                           FActorComponentTickFunction* ThisTickFunction) override;
-
-	void SetHeadComponent(USceneComponent* NewHeadComponent);
-
-	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement")
-	EVRNavigationModes NavigationMode = EVRNavigationModes::NAV_WALK;
-
-	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMin="0.0"))
-	float MaxStepHeight = 40.0f;
-
-	// if the height that the pawn would fall (in walking mode) is higher
-	// it is not falling, set to <0.0f if you want to fall infinitely
-	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement")
-	float MaxFallingDepth = 1000.0f;
-
-	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMax="0.0"))
-	float GravityAcceleration = -981.0f;
-
-	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMin="0.0"))
-	float UpSteppingAcceleration = 981.0f;
-
-	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMin="0.0"))
-	float CapsuleRadius = 40.0f;
-
-private:
-	//check for
-	FHitResult CreateCapsuleTrace(const FVector& Start, const FVector& End, bool DrawDebug = false) const;
-	FVector GetOverlapResolveDirection();
-	void SetCapsuleColliderToUserSize() const;
-	void CheckForPhysWalkingCollision();
-	FVector GetCollisionSafeVirtualSteeringVec(FVector InputVector, float DeltaTime);
-	void MoveByGravityOrStepUp(float DeltaSeconds);
-	void ShiftVertically(float Distance, float VerticalAcceleration, float DeltaSeconds);
-
-	UPROPERTY(VisibleAnywhere)
-	UCapsuleComponent* CapsuleColliderComponent = nullptr;
-	UPROPERTY()
-	USceneComponent* HeadComponent = nullptr;
-
-	float VerticalSpeed = 0.0f;
-	FVector LastCollisionFreeCapsulePosition;
-	FVector LastSteeringCollisionVector;
-
-	//just stored for performance gains;
-	UPROPERTY()
-	TArray<AActor*> ActorsToIgnore;
-};
+#pragma once
+
+#include "CoreMinimal.h"
+#include "GameFramework/FloatingPawnMovement.h"
+#include "Components/CapsuleComponent.h"
+
+#include "VRPawnMovement.generated.h"
+
+/*
+ * This Movement component is needed since in VR not only the pawn itself (UpdatedComponent) is moved but also the
+ * user herself can walk and thereby move the CameraComponent, which can also lead to collisions or e.g. going up steps 
+ *
+ * The four modes are:
+ * None: No controller movement is applied and no corrections regarding steps or collisions with walls are done
+ * Ghost: The same as above but now the Inputs can be used for unconstrained flying (also through objects)
+ * Fly: The user can fly but not through walls etc. When the user walks against a wall the scene is moved with her to avoid walking through
+ *      The user can also walk up stairs with a maximum step height of MaxStepHeight
+ * Walk: Additionally to Fly now gravity keeps the user on the floor
+ */
+
+UENUM(BlueprintType)
+enum class EVRNavigationModes : uint8
+{
+	NAV_NONE UMETA(DisplayName = "None (no controller movement)"),
+	NAV_GHOST UMETA(DisplayName = "Ghost (flying, also through walls)"),
+	NAV_FLY UMETA(DisplayName = "Fly (prohibiting collisions)"),
+	NAV_WALK UMETA(DisplayName = "Walk (gravity and prohibiting collisions)")
+};
+
+UCLASS()
+class RWTHVRTOOLKIT_API UVRPawnMovement : public UFloatingPawnMovement
+{
+	GENERATED_UCLASS_BODY()
+
+public:
+	virtual void BeginPlay() override;
+	void CheckAndRevertCollisionSinceLastTick();
+
+	void MoveOutOfNewDynamicCollisions();
+	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType,
+	                           FActorComponentTickFunction* ThisTickFunction) override;
+
+	void SetHeadComponent(USceneComponent* NewHeadComponent);
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement")
+	EVRNavigationModes NavigationMode = EVRNavigationModes::NAV_WALK;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMin="0.0"))
+	float MaxStepHeight = 40.0f;
+
+	// if the height that the pawn would fall (in walking mode) is higher
+	// it is not falling, set to <0.0f if you want to fall infinitely
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement")
+	float MaxFallingDepth = 1000.0f;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMax="0.0"))
+	float GravityAcceleration = -981.0f;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMin="0.0"))
+	float UpSteppingAcceleration = 981.0f;
+
+	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement", meta = (ClampMin="0.0"))
+	float CapsuleRadius = 40.0f;
+
+private:
+	//check for
+	FHitResult CreateCapsuleTrace(const FVector& Start, const FVector& End, bool DrawDebug = false) const;
+	FVector GetOverlapResolveDirection();
+	void SetCapsuleColliderToUserSize() const;
+	void CheckForPhysWalkingCollision();
+	FVector GetCollisionSafeVirtualSteeringVec(FVector InputVector, float DeltaTime);
+	void MoveByGravityOrStepUp(float DeltaSeconds);
+	void ShiftVertically(float Distance, float VerticalAcceleration, float DeltaSeconds);
+
+	UPROPERTY(VisibleAnywhere)
+	UCapsuleComponent* CapsuleColliderComponent = nullptr;
+	UPROPERTY()
+	USceneComponent* HeadComponent = nullptr;
+
+	float VerticalSpeed = 0.0f;
+	FVector LastCollisionFreeCapsulePosition;
+	FVector LastSteeringCollisionVector;
+
+	//just stored for performance gains;
+	UPROPERTY()
+	TArray<AActor*> ActorsToIgnore;
+};
diff --git a/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h b/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h
index 9238d465..4d057835 100644
--- a/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h
+++ b/Source/RWTHVRToolkit/Public/Pawn/VirtualRealityPawn.h
@@ -5,7 +5,7 @@
 #include "BasicVRInteractionComponent.h"
 #include "CoreMinimal.h"
 #include "LiveLinkRole.h"
-#include "Pawn/VRPawnMovement.h"
+#include "Pawn/Navigation/VRPawnMovement.h"
 #include "VirtualRealityPawn.generated.h"
 
 class UInputMappingContext;
-- 
GitLab