Skip to content
Snippets Groups Projects
Commit d4abf09c authored by David Gilbert's avatar David Gilbert :bug:
Browse files

Merge branch 'feature/add_rightclick_support' into 'dev/5.3'

Adding right-click support for the widget interaction component

See merge request !102
parents 03b450e9 f804c0eb
No related branches found
No related tags found
2 merge requests!109Final 5.3 release,!102Adding right-click support for the widget interaction component
Pipeline #503536 passed
...@@ -19,3 +19,6 @@ ...@@ -19,3 +19,6 @@
+FunctionRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.OnEndGrab",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.OnEndInteraction") +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.PreviousGrabBehavioursInRange",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.PreviousInteractableComponentsInRange")
+PropertyRedirects = (OldName="/Script/RWTHVRToolkit.DirectInteractionComponent.CurrentGrabBehavioursInRange",NewName="/Script/RWTHVRToolkit.DirectInteractionComponent.CurrentInteractableComponentsInRange") +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
No preview for this file type
No preview for this file type
File added
No preview for this file type
...@@ -51,10 +51,20 @@ void URWTHVRWidgetInteractionComponent::SetupPlayerInput(UInputComponent* Player ...@@ -51,10 +51,20 @@ void URWTHVRWidgetInteractionComponent::SetupPlayerInput(UInputComponent* Player
return; return;
} }
EI->BindAction(WidgetClickInputAction, ETriggerEvent::Started, this, if (WidgetLeftClickInputAction)
&URWTHVRWidgetInteractionComponent::OnBeginClick); {
EI->BindAction(WidgetClickInputAction, ETriggerEvent::Completed, this, EI->BindAction(WidgetLeftClickInputAction, ETriggerEvent::Started, this,
&URWTHVRWidgetInteractionComponent::OnEndClick); &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 // Called every frame
...@@ -99,17 +109,29 @@ void URWTHVRWidgetInteractionComponent::SetInteractionRayVisibility(EInteraction ...@@ -99,17 +109,29 @@ void URWTHVRWidgetInteractionComponent::SetInteractionRayVisibility(EInteraction
} }
// Forward the click to the WidgetInteraction // Forward the click to the WidgetInteraction
void URWTHVRWidgetInteractionComponent::OnBeginClick(const FInputActionValue& Value) void URWTHVRWidgetInteractionComponent::OnBeginLeftClick(const FInputActionValue& Value)
{ {
PressPointerKey(EKeys::LeftMouseButton); PressPointerKey(EKeys::LeftMouseButton);
} }
// Forward the end click to the WidgetInteraction // Forward the end click to the WidgetInteraction
void URWTHVRWidgetInteractionComponent::OnEndClick(const FInputActionValue& Value) void URWTHVRWidgetInteractionComponent::OnEndLeftClick(const FInputActionValue& Value)
{ {
ReleasePointerKey(EKeys::LeftMouseButton); 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() void URWTHVRWidgetInteractionComponent::CreateInteractionRay()
{ {
// Only create a new static mesh component if we haven't gotten one already // Only create a new static mesh component if we haven't gotten one already
......
...@@ -44,14 +44,22 @@ public: ...@@ -44,14 +44,22 @@ public:
TEnumAsByte<EInteractionRayVisibility> InteractionRayVisibility = EInteractionRayVisibility::Invisible; TEnumAsByte<EInteractionRayVisibility> InteractionRayVisibility = EInteractionRayVisibility::Invisible;
UPROPERTY(EditAnywhere, Category = "Input") UPROPERTY(EditAnywhere, Category = "Input")
class UInputAction* WidgetClickInputAction; class UInputAction* WidgetLeftClickInputAction;
UPROPERTY(EditAnywhere, Category = "Input")
class UInputAction* WidgetRightClickInputAction;
private: private:
UFUNCTION() UFUNCTION()
void OnBeginClick(const FInputActionValue& Value); void OnBeginLeftClick(const FInputActionValue& Value);
UFUNCTION()
void OnEndLeftClick(const FInputActionValue& Value);
UFUNCTION()
void OnBeginRightClick(const FInputActionValue& Value);
UFUNCTION() UFUNCTION()
void OnEndClick(const FInputActionValue& Value); void OnEndRightClick(const FInputActionValue& Value);
void CreateInteractionRay(); void CreateInteractionRay();
void SetupInteractionRay(); void SetupInteractionRay();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment