add a new FSGHandLayer::GetWristLocation() overload which allows passing FRotator instead of FQuat as input or output parameters

This commit is contained in:
Mamadou Babaei
2026-02-24 10:42:43 +01:00
parent b6f0c0602c
commit 1efaa0681d
5 changed files with 64 additions and 6 deletions
@@ -132,6 +132,25 @@ void FSGHandLayer::GetWristLocation(
OutWristRotation = MoveTemp(OutWristRotationContainer.Quat);
}
void FSGHandLayer::GetWristLocation(
const bool bRightHanded, const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware, FVector& OutWristPosition, FRotator& OutWristRotation)
{
FSGIC_FVector ReferencePositionContainer{ReferencePosition};
FSGIC_FQuat ReferenceRotationContainer{ReferenceRotation.Quaternion()};
FSGIC_ESGPositionalTrackingHardware TrackingHardwareContainer{TrackingHardware};
FSGIC_FVector OutWristPositionContainer;
FSGIC_FQuat OutWristRotationContainer;
SGCoreImpl_FSGHandLayerImpl_GetWristLocation(
bRightHanded, &ReferencePositionContainer, &ReferenceRotationContainer,
&TrackingHardwareContainer,
&OutWristPositionContainer, &OutWristRotationContainer);
OutWristPosition = MoveTemp(OutWristPositionContainer.Vector);
OutWristRotation = OutWristRotationContainer.Quat.Rotator();
}
void FSGHandLayer::StopAllHaptics(const bool bRightHanded)
{
SGCoreImpl_FSGHandLayerImpl_StopAllHaptics(bRightHanded);
@@ -42,6 +42,7 @@
#include "Containers/UnrealString.h"
#include "HAL/Platform.h"
#include "Math/Quat.h"
#include "Math/Rotator.h"
#include "Math/Vector.h"
#include "UObject/ObjectMacros.h"
@@ -148,6 +149,22 @@ public:
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation);
/**
* Calculate the Wrist Location of the chosen hand, based on a reference location and tracking hardware.
*
* @param bRightHanded
* @param ReferencePosition
* @param ReferenceRotation
* @param TrackingHardware
* @param OutWristPosition
* @param OutWristRotation
*/
static void GetWristLocation(
bool bRightHanded,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation);
/**
* Stop all haptics on the chosen hand.
*
@@ -91,10 +91,21 @@ bool USGHandLayerKismetLibrary::GetHandPose(UObject* WorldContextObject,
return FSGHandLayer::GetHandPose(WorldContextObject, bRightHanded, OutHandPose);
}
void USGHandLayerKismetLibrary::GetWristLocation(const bool bRightHanded,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
const ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation)
void USGHandLayerKismetLibrary::GetWristLocation_bRH_FQuat_RR_TH_OutWP_OutWR(
const bool bRightHanded,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation)
{
FSGHandLayer::GetWristLocation(bRightHanded, ReferencePosition, ReferenceRotation, TrackingHardware,
OutWristPosition, OutWristRotation);
}
void USGHandLayerKismetLibrary::GetWristLocation_bRH_RP_FRotator_RR_TH_OutWP_OutWR(
const bool bRightHanded,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation)
{
FSGHandLayer::GetWristLocation(bRightHanded, ReferencePosition, ReferenceRotation, TrackingHardware,
OutWristPosition, OutWristRotation);
@@ -122,13 +122,23 @@ public:
/**
* Calculate the Wrist Location of the chosen hand, based on a reference location and tracking hardware.
*/
UFUNCTION(BlueprintCallable, Category="SenseGlove | Core | Hand Layer")
static void GetWristLocation(
UFUNCTION(BlueprintCallable, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Hand Layer")
static void GetWristLocation_bRH_FQuat_RR_TH_OutWP_OutWR(
bool bRightHanded,
const FVector& ReferencePosition, const FQuat& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FQuat& OutWristRotation);
/**
* Calculate the Wrist Location of the chosen hand, based on a reference location and tracking hardware.
*/
UFUNCTION(BlueprintCallable, DisplayName="Get Wrist Location", Category="SenseGlove | Core | Hand Layer")
static void GetWristLocation_bRH_RP_FRotator_RR_TH_OutWP_OutWR(
bool bRightHanded,
const FVector& ReferencePosition, const FRotator& ReferenceRotation,
ESGPositionalTrackingHardware TrackingHardware,
FVector& OutWristPosition, FRotator& OutWristRotation);
/**
* Stop all haptics on the chosen hand.
*/