add support for wrist squeeze to the haptics component

This commit is contained in:
Mamadou Babaei
2026-02-10 11:35:28 +01:00
parent b565e79375
commit 62050fc62f
4 changed files with 55 additions and 0 deletions
@@ -37,6 +37,7 @@
#include "SGCore/SGCustomWaveform.h" #include "SGCore/SGCustomWaveform.h"
#include "SGCore/SGHapticGlove.h" #include "SGCore/SGHapticGlove.h"
#include "SGCore/SGHandLayer.h"
#include "SGTracking/SGGloveTracker.h" #include "SGTracking/SGGloveTracker.h"
struct USGHapticsComponent::FImpl struct USGHapticsComponent::FImpl
@@ -242,6 +243,16 @@ bool USGHapticsComponent::QueueVibroLevel(const ESGHapticLocation Location, cons
return false; 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) USGHapticsComponent::FImpl::FImpl(USGHapticsComponent* InOwner)
: Owner(InOwner) : Owner(InOwner)
{ {
@@ -198,4 +198,18 @@ public:
* vibration. * vibration.
*/ */
bool QueueVibroLevel(ESGHapticLocation Location, float Level01); 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);
}; };
@@ -139,4 +139,17 @@ bool UHapticsComponentKismetLibrary::QueueVibroLevel(
const ESGHapticLocation Location, const float Level01) const ESGHapticLocation Location, const float Level01)
{ {
return HapticsComponent->QueueVibroLevel(Location, 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);
} }
@@ -179,4 +179,21 @@ public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component") UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Haptics Component")
static bool QueueVibroLevel(UPARAM(ref) USGHapticsComponent* HapticsComponent, static bool QueueVibroLevel(UPARAM(ref) USGHapticsComponent* HapticsComponent,
ESGHapticLocation Location, float Level01); 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);
}; };