From 162416664abe36f553823a9d92f91ed5ce7a41d6 Mon Sep 17 00:00:00 2001 From: Mamadou Babaei Date: Tue, 10 Feb 2026 11:35:28 +0100 Subject: [PATCH] add support for wrist squeeze to the haptics component --- .../Components/SGHapticsComponent.cpp | 11 +++++++++++ .../SenseGlove/Components/SGHapticsComponent.h | 14 ++++++++++++++ .../SGHapticsComponentKismetLibrary.cpp | 13 +++++++++++++ .../SGKismet/SGHapticsComponentKismetLibrary.h | 17 +++++++++++++++++ 4 files changed, 55 insertions(+) diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGHapticsComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGHapticsComponent.cpp index e8e17837..60fa8274 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGHapticsComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGHapticsComponent.cpp @@ -37,6 +37,7 @@ #include "SGCore/SGCustomWaveform.h" #include "SGCore/SGHapticGlove.h" +#include "SGCore/SGHandLayer.h" #include "SGTracking/SGGloveTracker.h" struct USGHapticsComponent::FImpl @@ -242,6 +243,16 @@ bool USGHapticsComponent::QueueVibroLevel(const ESGHapticLocation Location, cons return false; } +bool USGHapticsComponent::SupportsWristSqueeze() const +{ + return FSGHandLayer::SupportsWristSqueeze(IsRight()); +} + +bool USGHapticsComponent::QueueWristSqueeze(const float SqueezeLevel01, const bool bSendImmediate) +{ + return FSGHandLayer::QueueCommand_WristSqueeze(IsRight(), SqueezeLevel01, bSendImmediate); +} + USGHapticsComponent::FImpl::FImpl(USGHapticsComponent* InOwner) : Owner(InOwner) { diff --git a/Source/SenseGlove/Public/SenseGlove/Components/SGHapticsComponent.h b/Source/SenseGlove/Public/SenseGlove/Components/SGHapticsComponent.h index e387e688..5d4f4058 100644 --- a/Source/SenseGlove/Public/SenseGlove/Components/SGHapticsComponent.h +++ b/Source/SenseGlove/Public/SenseGlove/Components/SGHapticsComponent.h @@ -198,4 +198,18 @@ public: * vibration. */ bool QueueVibroLevel(ESGHapticLocation Location, float Level01); + + /** + * Returns true if the chosen glove supports active contact feedback on the Wrist. + */ + bool SupportsWristSqueeze() const; + + /** + * Queue a command to set the amount of squeeze level (a.k.a. squeeze-feedback) to the desired level + * (0 = no squeeze, 1 = full squeeze) on the wrist, and optionally send it right away. + * + * @param SqueezeLevel01 + * @param bSendImmediate + */ + bool QueueWristSqueeze(float SqueezeLevel01, bool bSendImmediate); }; \ No newline at end of file diff --git a/Source/SenseGloveKismet/Private/SGKismet/SGHapticsComponentKismetLibrary.cpp b/Source/SenseGloveKismet/Private/SGKismet/SGHapticsComponentKismetLibrary.cpp index ec34c2e3..79ae1faa 100644 --- a/Source/SenseGloveKismet/Private/SGKismet/SGHapticsComponentKismetLibrary.cpp +++ b/Source/SenseGloveKismet/Private/SGKismet/SGHapticsComponentKismetLibrary.cpp @@ -139,4 +139,17 @@ bool UHapticsComponentKismetLibrary::QueueVibroLevel( const ESGHapticLocation Location, const float Level01) { return HapticsComponent->QueueVibroLevel(Location, Level01); +} + +bool UHapticsComponentKismetLibrary::SupportsWristSqueeze( + const USGHapticsComponent* HapticsComponent) +{ + return HapticsComponent->SupportsWristSqueeze(); +} + +bool UHapticsComponentKismetLibrary::QueueWristSqueeze( + USGHapticsComponent* HapticsComponent, + const float SqueezeLevel01, const bool bSendImmediate) +{ + return HapticsComponent->QueueWristSqueeze(SqueezeLevel01, bSendImmediate); } \ No newline at end of file diff --git a/Source/SenseGloveKismet/Public/SGKismet/SGHapticsComponentKismetLibrary.h b/Source/SenseGloveKismet/Public/SGKismet/SGHapticsComponentKismetLibrary.h index ea551105..5a5b09be 100644 --- a/Source/SenseGloveKismet/Public/SGKismet/SGHapticsComponentKismetLibrary.h +++ b/Source/SenseGloveKismet/Public/SGKismet/SGHapticsComponentKismetLibrary.h @@ -179,4 +179,21 @@ public: UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component") static bool QueueVibroLevel(UPARAM(ref) USGHapticsComponent* HapticsComponent, ESGHapticLocation Location, float Level01); + + /** + * Returns true if the chosen glove supports active contact feedback on the Wrist. + */ + UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component") + static bool SupportsWristSqueeze(const USGHapticsComponent* HapticsComponent); + + /** + * Queue a command to set the amount of squeeze level (a.k.a. squeeze-feedback) to the desired level + * (0 = no squeeze, 1 = full squeeze) on the wrist, and optionally send it right away. + * + * @param SqueezeLevel01 + * @param bSendImmediate + */ + UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component") + static bool QueueWristSqueeze(UPARAM(ref) USGHapticsComponent* HapticsComponent, + float SqueezeLevel01, bool bSendImmediate); }; \ No newline at end of file