diff --git a/Content/Components/Grabbing/BP_GrabComponent.uasset b/Content/Components/Grabbing/BP_GrabComponent.uasset index 5e0430e93aee43918ea62d4465f86e3812efe423..40c5437d25b66fce44d8073ff8f40103941f70bd 100644 Binary files a/Content/Components/Grabbing/BP_GrabComponent.uasset and b/Content/Components/Grabbing/BP_GrabComponent.uasset differ diff --git a/Content/Components/Grabbing/IMC_Grab.uasset b/Content/Components/Grabbing/IMC_Grab.uasset deleted file mode 100644 index 47abc9f0ea07957df2f54c0c80f683d07a14fadc..0000000000000000000000000000000000000000 Binary files a/Content/Components/Grabbing/IMC_Grab.uasset and /dev/null differ diff --git a/Content/Components/Movement/ContinuousMovement/BP_ContinuousMovementComponent.uasset b/Content/Components/Movement/ContinuousMovement/BP_ContinuousMovementComponent.uasset index 83b1677640b9495da4155029b2b3f320a66ccb81..6885feec7ec19c1fd7f5771d379225ebd86dd0e1 100644 Binary files a/Content/Components/Movement/ContinuousMovement/BP_ContinuousMovementComponent.uasset and b/Content/Components/Movement/ContinuousMovement/BP_ContinuousMovementComponent.uasset differ diff --git a/Content/Components/Movement/IMC_MovementLeftHand.uasset b/Content/Components/Movement/IMC_MovementLeftHand.uasset deleted file mode 100644 index d871b2eb4545c1acbc81470a80ae950683a574bc..0000000000000000000000000000000000000000 Binary files a/Content/Components/Movement/IMC_MovementLeftHand.uasset and /dev/null differ diff --git a/Content/Components/Movement/IMC_MovementRightHand.uasset b/Content/Components/Movement/IMC_MovementRightHand.uasset deleted file mode 100644 index b1eb664d5e755f86858f40ad6737e87e9dd29a0c..0000000000000000000000000000000000000000 Binary files a/Content/Components/Movement/IMC_MovementRightHand.uasset and /dev/null differ diff --git a/Content/Components/Movement/Teleportation/BP_TeleportationComponent.uasset b/Content/Components/Movement/Teleportation/BP_TeleportationComponent.uasset index d83f23de6da316687028de4c6a45713918bee2f4..724895615850f01d9d665e8b40569d5829fc4574 100644 Binary files a/Content/Components/Movement/Teleportation/BP_TeleportationComponent.uasset and b/Content/Components/Movement/Teleportation/BP_TeleportationComponent.uasset differ diff --git a/Content/Components/Movement/Turn/BP_TurnComponent.uasset b/Content/Components/Movement/Turn/BP_TurnComponent.uasset index e135a8eca226aa6043ca8dcdb87932775aadc93b..a572594744827a04a0a6a6b1912e80ef9be86297 100644 Binary files a/Content/Components/Movement/Turn/BP_TurnComponent.uasset and b/Content/Components/Movement/Turn/BP_TurnComponent.uasset differ diff --git a/Content/Components/Movement/Turn/IMC_DesktopRotation.uasset b/Content/Components/Movement/Turn/IMC_DesktopRotation.uasset deleted file mode 100644 index d68fb4eae4e33f04237249477b5a9994cb6b2721..0000000000000000000000000000000000000000 Binary files a/Content/Components/Movement/Turn/IMC_DesktopRotation.uasset and /dev/null differ diff --git a/Content/Components/Raycast/BP_RaycastSelectionComponent.uasset b/Content/Components/Raycast/BP_RaycastSelectionComponent.uasset index 4900352dfaa28d6b6f38c595e44bbc889891c947..8b06b970f91a7b78d47d15123f69c62cfaab798f 100644 Binary files a/Content/Components/Raycast/BP_RaycastSelectionComponent.uasset and b/Content/Components/Raycast/BP_RaycastSelectionComponent.uasset differ diff --git a/Content/Components/Raycast/IMC_RaycastSelection.uasset b/Content/Components/Raycast/IMC_RaycastSelection.uasset deleted file mode 100644 index c8107a17d2a2759c51d57c42495245273d290947..0000000000000000000000000000000000000000 Binary files a/Content/Components/Raycast/IMC_RaycastSelection.uasset and /dev/null differ diff --git a/Content/Components/WidgetInteraction/BP_RWTHVRWidgetInteractionComponent.uasset b/Content/Components/WidgetInteraction/BP_RWTHVRWidgetInteractionComponent.uasset index bbbac1fc6516d46209168216f4d8b502e88f0a38..904f5d3363442da0ff916b54041f595a4e023ffc 100644 Binary files a/Content/Components/WidgetInteraction/BP_RWTHVRWidgetInteractionComponent.uasset and b/Content/Components/WidgetInteraction/BP_RWTHVRWidgetInteractionComponent.uasset differ diff --git a/Content/Components/WidgetInteraction/IMC_WidgetInteraction.uasset b/Content/Components/WidgetInteraction/IMC_WidgetInteraction.uasset deleted file mode 100644 index d3751897c41b760e653f74954ff29956897cd671..0000000000000000000000000000000000000000 Binary files a/Content/Components/WidgetInteraction/IMC_WidgetInteraction.uasset and /dev/null differ diff --git a/Content/Input/Default_IMC/IMC_General.uasset b/Content/Input/Default_IMC/IMC_General.uasset new file mode 100644 index 0000000000000000000000000000000000000000..eda268398333a091619597aacd0c1dcf9c968807 Binary files /dev/null and b/Content/Input/Default_IMC/IMC_General.uasset differ diff --git a/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset b/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset new file mode 100644 index 0000000000000000000000000000000000000000..9b2aaf0578dc8427b0fa75dd604714885463aa12 Binary files /dev/null and b/Content/Input/Default_IMC/IMC_MovementLeftHand.uasset differ diff --git a/Content/Input/Default_IMC/IMC_MovementRightHand.uasset b/Content/Input/Default_IMC/IMC_MovementRightHand.uasset new file mode 100644 index 0000000000000000000000000000000000000000..44f4a88ed6719fb9bce0d3df925eb10fb58257d0 Binary files /dev/null and b/Content/Input/Default_IMC/IMC_MovementRightHand.uasset differ diff --git a/Content/Pawn/Base/BP_RWTHVRPawn_Base.uasset b/Content/Pawn/Base/BP_RWTHVRPawn_Base.uasset index bb1b9efe6103923e4c78cf3360ae385a63370e01..365910726f91633d9c128c5c2332139e31dfe8d1 100644 Binary files a/Content/Pawn/Base/BP_RWTHVRPawn_Base.uasset and b/Content/Pawn/Base/BP_RWTHVRPawn_Base.uasset differ diff --git a/Content/RWTHVRCluster/CAVEOverlay/BP_CaveOverlay.uasset b/Content/RWTHVRCluster/CAVEOverlay/BP_CaveOverlay.uasset index b98ef4a0d92337e6354a2b13a7b5fe78156bca8e..ab15ee9eb49fa5f0687da7bfff83330b505d4e03 100644 Binary files a/Content/RWTHVRCluster/CAVEOverlay/BP_CaveOverlay.uasset and b/Content/RWTHVRCluster/CAVEOverlay/BP_CaveOverlay.uasset differ diff --git a/Content/RWTHVRCluster/CAVEOverlay/IMC_Overlay.uasset b/Content/RWTHVRCluster/CAVEOverlay/IMC_Overlay.uasset deleted file mode 100644 index 23003cc697e730b961e3f32adad94eb1c46d8f37..0000000000000000000000000000000000000000 Binary files a/Content/RWTHVRCluster/CAVEOverlay/IMC_Overlay.uasset and /dev/null differ diff --git a/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp b/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp index 157e44d8a64c5d79b5aa6c8a0376838bc2c1842e..08d44b21a4e33283daa9a6a29b556beec0289cfa 100644 --- a/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp +++ b/Source/RWTHVRCluster/Private/CAVEOverlay/CAVEOverlayController.cpp @@ -2,7 +2,6 @@ #include "CoreMinimal.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "IDisplayCluster.h" #include "MotionControllerComponent.h" #include "Camera/CameraComponent.h" @@ -165,7 +164,7 @@ void ACAVEOverlayController::BeginPlay() // Input config if (URWTHVRUtilities::IsPrimaryNode()) { - if (CycleDoorTypeInputAction == nullptr || IMCCaveOverlayInputMapping == nullptr) + if (CycleDoorTypeInputAction == nullptr) { UE_LOGFMT(LogCAVEOverlay, Error, "Input action and mapping not set in CaveOverlayController!"); return; @@ -174,15 +173,6 @@ void ACAVEOverlayController::BeginPlay() UEnhancedInputComponent* Input = Cast<UEnhancedInputComponent>(PC->InputComponent); Input->BindAction(CycleDoorTypeInputAction, ETriggerEvent::Triggered, this, &ACAVEOverlayController::CycleDoorType); - - if (const ULocalPlayer* LocalPlayer = PC->GetLocalPlayer()) - { - if (UEnhancedInputLocalPlayerSubsystem* InputSystem = - LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>()) - { - InputSystem->AddMappingContext(IMCCaveOverlayInputMapping, 0); - } - } } // Bind the cluster events that manage the door state. diff --git a/Source/RWTHVRCluster/Public/CAVEOverlay/CAVEOverlayController.h b/Source/RWTHVRCluster/Public/CAVEOverlay/CAVEOverlayController.h index 234344221310b07fe6fe657468100cb4e4e11714..148897a8713c726bc9583de176cf04040b657074 100644 --- a/Source/RWTHVRCluster/Public/CAVEOverlay/CAVEOverlayController.h +++ b/Source/RWTHVRCluster/Public/CAVEOverlay/CAVEOverlayController.h @@ -128,9 +128,6 @@ public: UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "CAVEOverlay") UInputAction* CycleDoorTypeInputAction; - UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "CAVEOverlay") - UInputMappingContext* IMCCaveOverlayInputMapping; - UPROPERTY() UDoorOverlayData* Overlay; diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactors/GrabComponent.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactors/GrabComponent.cpp index fcc3abae942e3baa4d1fd01f453dabb6cf9d3b81..5dcc020c60082f9055c810c05ad74f968bf78dbb 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactors/GrabComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactors/GrabComponent.cpp @@ -4,7 +4,6 @@ #include "Interaction/Interactors/GrabComponent.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "Interaction/Interactables/InteractableComponent.h" #include "Interaction/Interactables/InteractionBitSet.h" @@ -89,13 +88,6 @@ void UGrabComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent) if (!Pawn) return; - auto* InputSubsystem = GetEnhancedInputLocalPlayerSubsystem(Pawn); - if (!InputSubsystem) - return; - - // add Input Mapping context - InputSubsystem->AddMappingContext(IMCGrab, 0); - UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(Pawn->InputComponent); if (EI == nullptr) return; diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp index bcbea769743979f8ca91339e038fe2ee0d3d99fd..020ae40bff8e17f164d2e7d895ae5860aab93de9 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp @@ -4,7 +4,6 @@ #include "Interaction/Interactors/RWTHVRWidgetInteractionComponent.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "Interaction/Interactors/GrabComponent.h" #include "Logging/StructuredLog.h" #include "Misc/Optional.h" @@ -35,39 +34,32 @@ void URWTHVRWidgetInteractionComponent::SetupPlayerInput(UInputComponent* Player if (!Pawn) { UE_LOGFMT(Toolkit, Warning, - "URWTHVRWidgetInteractionComponent::SetupPlayerInput requires a Pawn as Owner, which is not the case. Not setting up any input actions.") - ; + "URWTHVRWidgetInteractionComponent::SetupPlayerInput requires a Pawn as Owner, which is not the " + "case. Not setting up any input actions."); return; } - // We can be owned by a pawn, but not be the locally controlled pawn in a MP setting. In that case, just return and - // don't set up any inputs. - auto* InputSubsystem = GetEnhancedInputLocalPlayerSubsystem(Pawn); - if (!InputSubsystem) - return; - // Because we cannot use the regular debug ray (only works in editor), we set up our own (mesh) ray. SetupInteractionRay(); - // add Input Mapping context - InputSubsystem->AddMappingContext(IMCWidgetInteraction, 0); - UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(Pawn->InputComponent); if (!EI) { UE_LOGFMT(Toolkit, Warning, - "URWTHVRWidgetInteractionComponent::SetupPlayerInput: Cannot cast Pawn's InputComponent to UEnhancedInputComponent! Not binding any actions!") - ; + "URWTHVRWidgetInteractionComponent::SetupPlayerInput: Cannot cast Pawn's InputComponent to " + "UEnhancedInputComponent! Not binding any actions!"); return; } - EI->BindAction(WidgetClickInputAction, ETriggerEvent::Started, this, &URWTHVRWidgetInteractionComponent::OnBeginClick); - EI->BindAction(WidgetClickInputAction, ETriggerEvent::Completed, this, &URWTHVRWidgetInteractionComponent::OnEndClick); + EI->BindAction(WidgetClickInputAction, ETriggerEvent::Started, this, + &URWTHVRWidgetInteractionComponent::OnBeginClick); + EI->BindAction(WidgetClickInputAction, ETriggerEvent::Completed, this, + &URWTHVRWidgetInteractionComponent::OnEndClick); } // Called every frame void URWTHVRWidgetInteractionComponent::TickComponent(float DeltaTime, ELevelTick TickType, - FActorComponentTickFunction* ThisTickFunction) + FActorComponentTickFunction* ThisTickFunction) { // We should only tick on the local owner (the controlling client). Not on the server, not on any other pawn. // In theory, this should never happen as we only activate the component for the local player anyway. @@ -103,7 +95,7 @@ void URWTHVRWidgetInteractionComponent::SetInteractionRayVisibility(EInteraction InteractionRay->SetVisibility(NewVisibility == Visible); else UE_LOGFMT(Toolkit, Error, - "URWTHVRWidgetInteractionComponent::SetInteractionRayVisibility: InteractionRay not set yet!"); + "URWTHVRWidgetInteractionComponent::SetInteractionRayVisibility: InteractionRay not set yet!"); } // Forward the click to the WidgetInteraction @@ -173,7 +165,7 @@ void URWTHVRWidgetInteractionComponent::SetupInteractionRay() // turns off collisions as the InteractionRay is only meant to visualize the ray InteractionRay->SetCollisionProfileName(TEXT("NoCollision")); - //the ray model has a length of 100cm (and is a bit too big in Y/Z dir) + // the ray model has a length of 100cm (and is a bit too big in Y/Z dir) InteractionRay->SetRelativeScale3D(FVector(InteractionDistance / 100.0f, 0.5f, 0.5f)); SetInteractionRayVisibility(InteractionRayVisibility); diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactors/RaycastSelectionComponent.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactors/RaycastSelectionComponent.cpp index dc88e0375bf44a01c62aa2c91de71e9f18643bca..e10a44b0053726512f1ed80e98e853e411675377 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactors/RaycastSelectionComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactors/RaycastSelectionComponent.cpp @@ -4,7 +4,6 @@ #include "Interaction/Interactors/RaycastSelectionComponent.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "Interaction/Interactables/InteractableComponent.h" #include "Kismet/KismetSystemLibrary.h" @@ -82,13 +81,6 @@ void URaycastSelectionComponent::SetupPlayerInput(UInputComponent* PlayerInputCo if (!Pawn) return; - auto* InputSubsystem = GetEnhancedInputLocalPlayerSubsystem(Pawn); - if (!InputSubsystem) - return; - - // add Input Mapping context - InputSubsystem->AddMappingContext(IMCRaycastSelection, 0); - UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(Pawn->InputComponent); if (!EI) return; diff --git a/Source/RWTHVRToolkit/Private/Pawn/InputExtensionInterface.cpp b/Source/RWTHVRToolkit/Private/Pawn/InputExtensionInterface.cpp index ddee08706d0f68ad5a5ce1bd4c632642b3bc971f..03ea498fea124f6fe19b947e3cc370dd10295394 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/InputExtensionInterface.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/InputExtensionInterface.cpp @@ -2,12 +2,3 @@ #include "Pawn/InputExtensionInterface.h" - -UEnhancedInputLocalPlayerSubsystem* -IInputExtensionInterface::GetEnhancedInputLocalPlayerSubsystem(const APawn* Pawn) const -{ - const APlayerController* PlayerController = Pawn ? Cast<APlayerController>(Pawn->GetController()) : nullptr; - const ULocalPlayer* LP = PlayerController ? PlayerController->GetLocalPlayer() : nullptr; - - return LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(); -} diff --git a/Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp index 9954fc63fe80c2c19602fdd77ee2c52e1bffd848..988d1618a5ec3a80c6016c027bf0c3b89aeaaa0b 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/ContinuousMovementComponent.cpp @@ -3,7 +3,6 @@ #include "Pawn/Navigation/ContinuousMovementComponent.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "Engine/LocalPlayer.h" #include "GameFramework/PlayerController.h" #include "Utility/RWTHVRUtilities.h" @@ -13,7 +12,7 @@ void UContinuousMovementComponent::SetupPlayerInput(UInputComponent* PlayerInput { Super::SetupPlayerInput(PlayerInputComponent); - if (!VRPawn || !VRPawn->HasLocalNetOwner() || !InputSubsystem) + if (!VRPawn || !VRPawn->HasLocalNetOwner()) { return; } @@ -23,18 +22,13 @@ void UContinuousMovementComponent::SetupPlayerInput(UInputComponent* PlayerInput { MovementHand = VRPawn->RightHand; RotationHand = VRPawn->LeftHand; - IMCMovement = IMCMovementRight; } else { MovementHand = VRPawn->LeftHand; RotationHand = VRPawn->RightHand; - IMCMovement = IMCMovementLeft; } - // add Input Mapping context - InputSubsystem->AddMappingContext(IMCMovement, 0); - UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(PlayerInputComponent); if (!EI) { diff --git a/Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp index 48562102b52c22c22b8f6f874e451f74d150534e..2020468fb5fcaefc05c91b8d49dd498f42bfedd7 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/MovementComponentBase.cpp @@ -3,27 +3,13 @@ #include "Pawn/Navigation/MovementComponentBase.h" -#include "EnhancedInputSubsystems.h" #include "Engine/LocalPlayer.h" #include "GameFramework/PlayerController.h" #include "Pawn/RWTHVRPawn.h" -#include "Utility/RWTHVRUtilities.h" void UMovementComponentBase::SetupPlayerInput(UInputComponent* PlayerInputComponent) { IInputExtensionInterface::SetupPlayerInput(PlayerInputComponent); VRPawn = Cast<ARWTHVRPawn>(GetOwner()); - - if (!VRPawn || !VRPawn->HasLocalNetOwner()) - { - return; - } - - InputSubsystem = GetEnhancedInputLocalPlayerSubsystem(VRPawn); - if (!InputSubsystem) - { - UE_LOG(Toolkit, Error, TEXT("InputSubsystem IS NOT VALID")); - return; - } } diff --git a/Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp index 3e1e14b8f4ab4bf57ad956550afa9059ff93162a..fd805c9212dfeb6149a97b318e19bf172d39cd27 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/TeleportationComponent.cpp @@ -4,7 +4,6 @@ #include "Pawn/Navigation/TeleportationComponent.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "NavigationSystem.h" #include "Engine/LocalPlayer.h" #include "GameFramework/PlayerController.h" @@ -19,7 +18,7 @@ void UTeleportationComponent::SetupPlayerInput(UInputComponent* PlayerInputCompo { Super::SetupPlayerInput(PlayerInputComponent); - if (!VRPawn || !VRPawn->HasLocalNetOwner() || !InputSubsystem) + if (!VRPawn || !VRPawn->HasLocalNetOwner()) { return; } @@ -44,18 +43,13 @@ void UTeleportationComponent::SetupPlayerInput(UInputComponent* PlayerInputCompo { TeleportationHand = VRPawn->RightHand; RotationHand = VRPawn->LeftHand; - IMCMovement = IMCTeleportRight; } else { TeleportationHand = VRPawn->LeftHand; RotationHand = VRPawn->RightHand; - IMCMovement = IMCTeleportLeft; } - // add Input Mapping context - InputSubsystem->AddMappingContext(IMCMovement, 0); - UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(PlayerInputComponent); if (!EI) { diff --git a/Source/RWTHVRToolkit/Private/Pawn/Navigation/TurnComponent.cpp b/Source/RWTHVRToolkit/Private/Pawn/Navigation/TurnComponent.cpp index 31e57513a8de14a7f2aab645ef6ec69a497d0bf4..bcf78e6bd57870bc4e3aef0bbeccb3b730aa0f0e 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/Navigation/TurnComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/Navigation/TurnComponent.cpp @@ -4,7 +4,6 @@ #include "Pawn/Navigation/TurnComponent.h" #include "EnhancedInputComponent.h" -#include "EnhancedInputSubsystems.h" #include "Pawn/RWTHVRPawn.h" #include "Utility/RWTHVRUtilities.h" @@ -12,7 +11,7 @@ void UTurnComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent) { Super::SetupPlayerInput(PlayerInputComponent); - if (!VRPawn || !VRPawn->HasLocalNetOwner() || !InputSubsystem) + if (!VRPawn || !VRPawn->HasLocalNetOwner()) { return; } @@ -21,22 +20,12 @@ void UTurnComponent::SetupPlayerInput(UInputComponent* PlayerInputComponent) if (bTurnWithLeftHand) { RotationHand = VRPawn->LeftHand; - // we use the same IMC for movement and turning - // therefore if we move with the right hand, we turn with the left hand - IMCTurn = IMCMovement_Right; } else { RotationHand = VRPawn->RightHand; - // we use the same IMC for movement and turning - // therefore if we move with the left hand, we turn with the right hand - IMCTurn = IMCMovement_Left; } - // add Input Mapping context - InputSubsystem->AddMappingContext(URWTHVRUtilities::IsDesktopMode() ? IMCDesktopRotation : IMCTurn, 0); - - UEnhancedInputComponent* EI = Cast<UEnhancedInputComponent>(PlayerInputComponent); if (!EI) { diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index eee711326be2929cae7f232537c7dc74c37d42c6..f31909feef9e99f2c4f2d7ce052f4e9dee59a3af 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -2,6 +2,7 @@ #include "Pawn/RWTHVRPawn.h" +#include "EnhancedInputSubsystems.h" #include "Engine/LocalPlayer.h" #include "GameFramework/PlayerController.h" #include "ILiveLinkClient.h" @@ -132,6 +133,37 @@ void ARWTHVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen { Cast<IInputExtensionInterface>(Comp)->SetupPlayerInput(PlayerInputComponent); } + + // bind the current mapping contexts + AddInputMappingContext(PlayerController, CurrentGeneralInputMappingContext); + AddInputMappingContext(PlayerController, CurrentMovementInputMappingContext); +} + +void ARWTHVRPawn::AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const +{ + if (Context) + { + if (const ULocalPlayer* LP = PC->GetLocalPlayer()) + { + if (UEnhancedInputLocalPlayerSubsystem* InputSub = LP->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>()) + { + InputSub->AddMappingContext(Context, 0); + } + else + { + UE_LOGFMT(Toolkit, Warning, + "ARWTHVRPawn::AddInputMappingContext: UEnhancedInputLocalPlayerSubsystem is nullptr!"); + } + } + else + { + UE_LOGFMT(Toolkit, Warning, "ARWTHVRPawn::AddInputMappingContext: LocalPlayer is nullptr!"); + } + } + else + { + UE_LOGFMT(Toolkit, Warning, "ARWTHVRPawn::AddInputMappingContext: Context is nullptr!"); + } } void ARWTHVRPawn::EvaluateLivelink() const diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactors/GrabComponent.h b/Source/RWTHVRToolkit/Public/Interaction/Interactors/GrabComponent.h index 84e1eea6a0eb35fe03519d7eebf39fc93fa0fde0..f2ef437a3c2ec1b11809c61b8716075ac8f673ea 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactors/GrabComponent.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactors/GrabComponent.h @@ -22,9 +22,6 @@ public: virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; - UPROPERTY(EditDefaultsOnly, Category = "Input") - class UInputMappingContext* IMCGrab; - UPROPERTY(EditAnywhere, Category = "Input") class UInputAction* GrabInputAction; diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h b/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h index 35e32044552e9f84fa5314042b8f926678da5e01..4b1139cf89724faea664f4ac4e2e42f9cf1bb9db 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h @@ -11,16 +11,15 @@ UENUM() enum EInteractionRayVisibility { Visible UMETA(DisplayName = "Interaction ray visible"), - VisibleOnHoverOnly UMETA( - DisplayName = - "Interaction ray only visible when hovering over interactable world UI widgets"), + VisibleOnHoverOnly UMETA(DisplayName = + "Interaction ray only visible when hovering over interactable world UI widgets"), Invisible UMETA(DisplayName = "Interaction ray invisible") }; -UCLASS(Blueprintable, Abstract, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) +UCLASS(Blueprintable, Abstract, ClassGroup = (Custom), meta = (BlueprintSpawnableComponent)) class RWTHVRTOOLKIT_API URWTHVRWidgetInteractionComponent : public UWidgetInteractionComponent, - public IInputExtensionInterface + public IInputExtensionInterface { GENERATED_BODY() @@ -30,7 +29,7 @@ public: virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override; virtual void TickComponent(float DeltaTime, ELevelTick TickType, - FActorComponentTickFunction* ThisTickFunction) override; + FActorComponentTickFunction* ThisTickFunction) override; UFUNCTION(BlueprintCallable) void SetInteractionRayVisibility(EInteractionRayVisibility NewVisibility); @@ -44,9 +43,6 @@ public: UPROPERTY(EditAnywhere) TEnumAsByte<EInteractionRayVisibility> InteractionRayVisibility = EInteractionRayVisibility::Invisible; - UPROPERTY(EditDefaultsOnly, Category = "Input") - class UInputMappingContext* IMCWidgetInteraction; - UPROPERTY(EditAnywhere, Category = "Input") class UInputAction* WidgetClickInputAction; diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactors/RaycastSelectionComponent.h b/Source/RWTHVRToolkit/Public/Interaction/Interactors/RaycastSelectionComponent.h index 45095c3ac50cc2b81e691e9463d3af2253815173..b77f9ca80f6b66bdce3d47771bfab14d9daa39b8 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactors/RaycastSelectionComponent.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactors/RaycastSelectionComponent.h @@ -22,10 +22,6 @@ public: virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; - - UPROPERTY(EditDefaultsOnly, Category = "Input") - class UInputMappingContext* IMCRaycastSelection; - UPROPERTY(EditAnywhere, Category = "Input") class UInputAction* RayCastSelectInputAction; diff --git a/Source/RWTHVRToolkit/Public/Pawn/InputExtensionInterface.h b/Source/RWTHVRToolkit/Public/Pawn/InputExtensionInterface.h index 51963c0a1514950229a8b8286ad41e407accd362..5d38f4f28172c1053ba3fed15bc0ce0c3c1c8252 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/InputExtensionInterface.h +++ b/Source/RWTHVRToolkit/Public/Pawn/InputExtensionInterface.h @@ -24,7 +24,4 @@ class RWTHVRTOOLKIT_API IInputExtensionInterface public: // Called by VirtualRealityPawn::SetupPlayerInputComponent virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) {} - - // Helper function to get the local player subsystem - virtual UEnhancedInputLocalPlayerSubsystem* GetEnhancedInputLocalPlayerSubsystem(const APawn* Pawn) const; }; diff --git a/Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h index adbcef6f926e48e57d379423f0b1829f699fe4e3..06e715c52436b903f07978de0ec6508432fedbf1 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h +++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/ContinuousMovementComponent.h @@ -31,12 +31,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement") bool bMoveWithRightHand = true; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - UInputMappingContext* IMCMovementLeft; - - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - UInputMappingContext* IMCMovementRight; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input|Actions") UInputAction* Move; @@ -53,9 +47,6 @@ public: virtual void SetupPlayerInput(UInputComponent* PlayerInputComponent) override; private: - UPROPERTY() - class UInputMappingContext* IMCMovement; - UPROPERTY() UMotionControllerComponent* MovementHand; diff --git a/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h index d2a687130b4f8caf850c25a75b92a4c9364aa66c..f9d03b513f1e7f1c4da813240436982063f9ab24 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h +++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/MovementComponentBase.h @@ -24,7 +24,4 @@ public: protected: UPROPERTY() ARWTHVRPawn* VRPawn; - - UPROPERTY() - UEnhancedInputLocalPlayerSubsystem* InputSubsystem; }; diff --git a/Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h index e66968a3b77531ba983d24ad05bcda0451282a8c..308634643f4a0ad6520ab882e384a8bbe8ff8e96 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h +++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/TeleportationComponent.h @@ -34,12 +34,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VR Movement|Teleport") float TeleportLaunchSpeed = 800; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - UInputMappingContext* IMCTeleportLeft; - - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - UInputMappingContext* IMCTeleportRight; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input|Actions") UInputAction* Move; @@ -73,9 +67,6 @@ private: UPROPERTY() UMotionControllerComponent* RotationHand; - UPROPERTY() - UInputMappingContext* IMCMovement; - bool bTeleportTraceActive; float TeleportProjectileRadius = 3.6; float RotationArrowRadius = 10.0; diff --git a/Source/RWTHVRToolkit/Public/Pawn/Navigation/TurnComponent.h b/Source/RWTHVRToolkit/Public/Pawn/Navigation/TurnComponent.h index de3f274e28caf8f353349798a84c4f2dfc02356d..25576574f32fdbfc5bf095bad2c6d9dfeafee066 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/Navigation/TurnComponent.h +++ b/Source/RWTHVRToolkit/Public/Pawn/Navigation/TurnComponent.h @@ -39,16 +39,6 @@ public: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input|Actions") class UInputAction* DesktopRotation; - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - class UInputMappingContext* IMCMovement_Left; - - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - class UInputMappingContext* IMCMovement_Right; - - /**Input Mapping Context that maps buttons for desktop mode*/ - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "VR Movement|Input") - class UInputMappingContext* IMCDesktopRotation; - /** * Called every tick as long as stick input is received to allow for continuous turning * @param Value Stick input value determines turn direction and turn speed @@ -75,9 +65,6 @@ private: UPROPERTY() UMotionControllerComponent* RotationHand; - UPROPERTY() - class UInputMappingContext* IMCTurn; - /** * If we just use VRPawn->AddControllerYawInput(Yaw), rotation is around tracking origin instead of the actual * player position This function updates the pawns rotation and location to result in a rotation around the users diff --git a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h index 50b98e0e84c1cfb5461c2d5764147fe6de77ca32..9f676d1131ac0986c7ce71e5ac7b96c6b74a77c4 100644 --- a/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h +++ b/Source/RWTHVRToolkit/Public/Pawn/RWTHVRPawn.h @@ -31,6 +31,12 @@ public: virtual void NotifyControllerChanged() override; + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Pawn|Input") + UInputMappingContext* CurrentGeneralInputMappingContext; + + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Pawn|Input") + UInputMappingContext* CurrentMovementInputMappingContext; + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pawn|MotionControllers") UMotionControllerComponent* RightHand; @@ -82,6 +88,7 @@ public: protected: virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override; + void AddInputMappingContext(const APlayerController* PC, const UInputMappingContext* Context) const; /* LiveLink helper function called on tick */ void EvaluateLivelink() const;