diff --git a/Config/DefaultRWTHVRToolkit.ini b/Config/DefaultRWTHVRToolkit.ini index 13066ebe26e8ab454486f97bbb982275d9b2587c..1fa18ba2f268987d434816d472da165fe8486d48 100644 --- a/Config/DefaultRWTHVRToolkit.ini +++ b/Config/DefaultRWTHVRToolkit.ini @@ -18,4 +18,7 @@ +FunctionRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.OnBeginGrab",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.OnBeginInteraction") +FunctionRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.OnEndGrab",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.OnEndInteraction") +PropertyRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.PreviousGrabBehavioursInRange",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.PreviousInteractableComponentsInRange") -+PropertyRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.CurrentGrabBehavioursInRange",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.CurrentInteractableComponentsInRange") \ No newline at end of file ++PropertyRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.CurrentGrabBehavioursInRange",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.CurrentInteractableComponentsInRange") ++PropertyRedirects=(OldName="/Script/RWTHVRToolkit.RWTHVRWidgetInteractionComponent.WidgetClickInputAction",NewName="/Script/RWTHVRToolkit.RWTHVRWidgetInteractionComponent.WidgetLeftClickInputAction") ++FunctionRedirects=(OldName="/Script/RWTHVRToolkit.RWTHVRWidgetInteractionComponent.OnBeginClick",NewName="/Script/RWTHVRToolkit.RWTHVRWidgetInteractionComponent.OnBeginLeftClick") ++FunctionRedirects=(OldName="/Script/RWTHVRToolkit.RWTHVRWidgetInteractionComponent.OnEndClick",NewName="/Script/RWTHVRToolkit.RWTHVRWidgetInteractionComponent.OnEndLeftClick") \ No newline at end of file diff --git a/Content/BP_RWTHVRGameModeBase.uasset b/Content/BP_RWTHVRGameModeBase.uasset index a073a7f7cc247654e724c9d348d57f9bdc55d9ed..3bfda91bae7068c7283ece3e8bbe26477c25bd90 100644 Binary files a/Content/BP_RWTHVRGameModeBase.uasset and b/Content/BP_RWTHVRGameModeBase.uasset differ diff --git a/Content/Components/WidgetInteraction/BP_RWTHVRWidgetInteractionComponent.uasset b/Content/Components/WidgetInteraction/BP_RWTHVRWidgetInteractionComponent.uasset index 904f5d3363442da0ff916b54041f595a4e023ffc..f6f9bafd520036d434be5501aade85a17a8a6f7a 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/IA_WidgetClick.uasset b/Content/Components/WidgetInteraction/IA_WidgetClick.uasset deleted file mode 100644 index 470e02e6edeec5b128dd66f602fc5680e3fb9dbe..0000000000000000000000000000000000000000 Binary files a/Content/Components/WidgetInteraction/IA_WidgetClick.uasset and /dev/null differ diff --git a/Content/Components/WidgetInteraction/IA_WidgetLeftClick.uasset b/Content/Components/WidgetInteraction/IA_WidgetLeftClick.uasset new file mode 100644 index 0000000000000000000000000000000000000000..c3e97377bcc821f4ea99df5a92b44594c710564f Binary files /dev/null and b/Content/Components/WidgetInteraction/IA_WidgetLeftClick.uasset differ diff --git a/Content/Components/WidgetInteraction/IA_WidgetRightClick.uasset b/Content/Components/WidgetInteraction/IA_WidgetRightClick.uasset new file mode 100644 index 0000000000000000000000000000000000000000..320bf66bc73fa8714baae5258c680aba5f20261a Binary files /dev/null and b/Content/Components/WidgetInteraction/IA_WidgetRightClick.uasset differ diff --git a/Content/Input/Default_IMC/IMC_General.uasset b/Content/Input/Default_IMC/IMC_General.uasset index 6acdb72a1f1896d89873376ff2a06bdd4788506a..89b1411e4650beb0d2d263244dd0a9e21e5e936b 100644 Binary files a/Content/Input/Default_IMC/IMC_General.uasset and b/Content/Input/Default_IMC/IMC_General.uasset differ diff --git a/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp b/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp index 3a87de65d2cb52a5bce0dd0aa71af9dd3b2f69bb..23e0727a0f17734282db4c1f0051965789b938ca 100644 --- a/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp +++ b/Source/RWTHVRToolkit/Private/Interaction/Interactors/RWTHVRWidgetInteractionComponent.cpp @@ -51,10 +51,20 @@ void URWTHVRWidgetInteractionComponent::SetupPlayerInput(UInputComponent* Player return; } - EI->BindAction(WidgetClickInputAction, ETriggerEvent::Started, this, - &URWTHVRWidgetInteractionComponent::OnBeginClick); - EI->BindAction(WidgetClickInputAction, ETriggerEvent::Completed, this, - &URWTHVRWidgetInteractionComponent::OnEndClick); + if (WidgetLeftClickInputAction) + { + EI->BindAction(WidgetLeftClickInputAction, ETriggerEvent::Started, this, + &URWTHVRWidgetInteractionComponent::OnBeginLeftClick); + EI->BindAction(WidgetLeftClickInputAction, ETriggerEvent::Completed, this, + &URWTHVRWidgetInteractionComponent::OnEndLeftClick); + } + if (WidgetRightClickInputAction) + { + EI->BindAction(WidgetRightClickInputAction, ETriggerEvent::Started, this, + &URWTHVRWidgetInteractionComponent::OnBeginRightClick); + EI->BindAction(WidgetRightClickInputAction, ETriggerEvent::Completed, this, + &URWTHVRWidgetInteractionComponent::OnEndRightClick); + } } // Called every frame @@ -99,17 +109,29 @@ void URWTHVRWidgetInteractionComponent::SetInteractionRayVisibility(EInteraction } // Forward the click to the WidgetInteraction -void URWTHVRWidgetInteractionComponent::OnBeginClick(const FInputActionValue& Value) +void URWTHVRWidgetInteractionComponent::OnBeginLeftClick(const FInputActionValue& Value) { PressPointerKey(EKeys::LeftMouseButton); } // Forward the end click to the WidgetInteraction -void URWTHVRWidgetInteractionComponent::OnEndClick(const FInputActionValue& Value) +void URWTHVRWidgetInteractionComponent::OnEndLeftClick(const FInputActionValue& Value) { ReleasePointerKey(EKeys::LeftMouseButton); } +// Forward the click to the WidgetInteraction +void URWTHVRWidgetInteractionComponent::OnBeginRightClick(const FInputActionValue& Value) +{ + PressPointerKey(EKeys::RightMouseButton); +} + +// Forward the end click to the WidgetInteraction +void URWTHVRWidgetInteractionComponent::OnEndRightClick(const FInputActionValue& Value) +{ + ReleasePointerKey(EKeys::RightMouseButton); +} + void URWTHVRWidgetInteractionComponent::CreateInteractionRay() { // Only create a new static mesh component if we haven't gotten one already diff --git a/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h b/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h index 4b1139cf89724faea664f4ac4e2e42f9cf1bb9db..34770d50d324a6f2e311f898636aefc1610a5140 100644 --- a/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h +++ b/Source/RWTHVRToolkit/Public/Interaction/Interactors/RWTHVRWidgetInteractionComponent.h @@ -44,14 +44,22 @@ public: TEnumAsByte<EInteractionRayVisibility> InteractionRayVisibility = EInteractionRayVisibility::Invisible; UPROPERTY(EditAnywhere, Category = "Input") - class UInputAction* WidgetClickInputAction; + class UInputAction* WidgetLeftClickInputAction; + UPROPERTY(EditAnywhere, Category = "Input") + class UInputAction* WidgetRightClickInputAction; private: UFUNCTION() - void OnBeginClick(const FInputActionValue& Value); + void OnBeginLeftClick(const FInputActionValue& Value); + + UFUNCTION() + void OnEndLeftClick(const FInputActionValue& Value); + + UFUNCTION() + void OnBeginRightClick(const FInputActionValue& Value); UFUNCTION() - void OnEndClick(const FInputActionValue& Value); + void OnEndRightClick(const FInputActionValue& Value); void CreateInteractionRay(); void SetupInteractionRay();