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

Merge branch 'feature/right_click54' into 'dev/5.4'

Adding right-click support for the widget interaction component

See merge request !106
parents 53de8514 06e3adba
Branches
Tags
2 merge requests!107UE5.4-2024.1-rc1,!106Adding right-click support for the widget interaction component
......@@ -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
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
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
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment