remove support for FXRMotionControllerData on UE 5.7 as it has been obliterated by the upstream and apply necessary changes to make XR_EXT_hand_tracking work again on 5.7

This commit is contained in:
Mamadou Babaei
2025-11-18 03:23:24 +01:00
parent 2a51d58f05
commit 93e8e7878b
16 changed files with 39 additions and 372 deletions
@@ -109,8 +109,6 @@ struct USGVirtualHandComponent::FImpl
ECollisionEnabled::Type CachedCollisionEnabled;
FCollisionResponseContainer CachedCollisionResponse;
FXRMotionControllerData MotionControllerData;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
FXRMotionControllerState MotionControllerState;
FXRHandTrackingState HandTrackingState;
@@ -475,11 +473,6 @@ USGHapticGlove* USGVirtualHandComponent::GetConnectedGlove() const
return Glove;
}
const FXRMotionControllerData& USGVirtualHandComponent::GetMotionControllerData() const
{
return Pimpl->MotionControllerData;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& USGVirtualHandComponent::GetHandTrackingState() const
{
@@ -879,6 +872,8 @@ void USGVirtualHandComponent::FImpl::StartXRDataRetrievalTimer()
{
const EControllerHand Hand = Owner->IsRight() ? EControllerHand::Right : EControllerHand::Left;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
{
FXRMotionControllerData Data;
Data.bValid = false;
@@ -891,6 +886,7 @@ void USGVirtualHandComponent::FImpl::StartXRDataRetrievalTimer()
(void) bGotMotionControllerData;
MotionControllerData = MoveTemp(Data);
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
{
@@ -66,8 +66,6 @@ struct USGWristTrackerComponent::FImpl
bool bOverridePluginSettingsPropertyAlreadyModified;
FXRMotionControllerData MotionControllerData;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
FXRMotionControllerState MotionControllerState;
FXRHandTrackingState HandTrackingState;
@@ -258,11 +256,6 @@ void USGWristTrackerComponent::EditorTick(
{
}
const FXRMotionControllerData& USGWristTrackerComponent::GetMotionControllerData() const
{
return Pimpl->MotionControllerData;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& USGWristTrackerComponent::GetHandTrackingState() const
{
@@ -386,19 +379,6 @@ void USGWristTrackerComponent::FImpl::StartXRDataRetrievalTimer()
{
const EControllerHand Hand = Owner->IsRight() ? EControllerHand::Right : EControllerHand::Left;
{
FXRMotionControllerData Data;
Data.bValid = false;
PRAGMA_DISABLE_DEPRECATION_WARNINGS
const bool bGotMotionControllerData =
FSGXRTracker::GetMotionControllerData(Owner, Hand, Data);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
(void) bGotMotionControllerData;
MotionControllerData = MoveTemp(Data);
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
{
FXRHandTrackingState State;
@@ -181,9 +181,6 @@ public:
bool IsGloveConnected() const;
USGHapticGlove* GetConnectedGlove() const;
UE_DEPRECATED(5.5, "Deprecated by UE 5.5 in favor of GetMotionControllerState and GetHandTrackingState")
const FXRMotionControllerData& GetMotionControllerData() const;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& GetHandTrackingState() const;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
@@ -165,9 +165,6 @@ protected:
FActorComponentTickFunction* ThisTickFunction);
public:
UE_DEPRECATED(5.5, "Deprecated by UE 5.5 in favor of GetMotionControllerState and GetHandTrackingState")
const FXRMotionControllerData& GetMotionControllerData() const;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
const FXRHandTrackingState& GetHandTrackingState() const;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
@@ -44,49 +44,6 @@
#include "SGDebug/SGDebugCube.h"
#include "SGDebug/SGDebugGizmo.h"
void FSGDebugVirtualHand::Draw(
const UWorld* World,
const FXRMotionControllerData& MotionControllerData,
const FSGVirtualHandDebuggingSettings& Settings)
{
if (!ensureAlwaysMsgf(
Settings.DrawingMode != ESGDebugVirtualHandDrawingMode::None,
TEXT("Invalid virtual hand drawing mode!")))
{
return;
}
if (!ensureAlwaysMsgf(
MotionControllerData.bValid,
TEXT("Invalid motion controller data!")))
{
return;
}
if (!ensureAlwaysMsgf(
MotionControllerData.HandKeyPositions.Num() == MotionControllerData.HandKeyRotations.Num(),
TEXT("Mismatched motion controller data positions and rotations!")))
{
return;
}
for (TArray<FVector>::SizeType HandKeyIndex = 0;
HandKeyIndex < MotionControllerData.HandKeyPositions.Num(); ++HandKeyIndex)
{
const FVector& HandKeyPosition{MotionControllerData.HandKeyPositions[HandKeyIndex]};
const FQuat& HandKeyRotation{MotionControllerData.HandKeyRotations[HandKeyIndex]};
if (Settings.DrawingMode == ESGDebugVirtualHandDrawingMode::CubicJoints)
{
FSGDebugCube::Draw(World, HandKeyPosition, HandKeyRotation, Settings.DebugCubicHandSettings);
}
else if (Settings.DrawingMode == ESGDebugVirtualHandDrawingMode::GizmoJoints)
{
FSGDebugGizmo::Draw(World, HandKeyPosition, HandKeyRotation, Settings.DebugGizmoHandSettings);
}
}
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
void FSGDebugVirtualHand::Draw(
const UWorld* World,
@@ -48,12 +48,6 @@ class UWorld;
class SENSEGLOVEDEBUG_API FSGDebugVirtualHand final
{
public:
UE_DEPRECATED(5.5, "Deprecated in favor of the variant that accepts FXRHandTrackingState")
static void Draw(
const UWorld* World,
const FXRMotionControllerData& MotionControllerData,
const FSGVirtualHandDebuggingSettings& Settings);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
static void Draw(
const UWorld* World,
@@ -37,18 +37,6 @@
#include "SGDebug/SGDebugVirtualHand.h"
void USGDebugVirtualHandKismetLibrary::Draw_FXRMotionControllerData(
UObject* WorldContextObject,
const FXRMotionControllerData& MotionControllerData,
const FSGVirtualHandDebuggingSettings& Settings)
{
ensureAlwaysMsgf(WorldContextObject, TEXT("Invalid world context object!"));
PRAGMA_DISABLE_DEPRECATION_WARNINGS
FSGDebugVirtualHand::Draw(WorldContextObject->GetWorld(), MotionControllerData, Settings);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
void USGDebugVirtualHandKismetLibrary::Draw_FXRHandTrackingState(
UObject* WorldContextObject,
const FXRHandTrackingState& HandTrackingState,
@@ -50,13 +50,6 @@ class SENSEGLOVEDEBUGKISMET_API USGDebugVirtualHandKismetLibrary final : public
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, DisplayName="Draw", Category="SenseGlove | Debug | Virtual Hand",
meta=(WorldContext="WorldContextObject"))
static void Draw_FXRMotionControllerData(
UObject* WorldContextObject,
const FXRMotionControllerData& MotionControllerData,
const FSGVirtualHandDebuggingSettings& Settings);
UFUNCTION(BlueprintCallable, DisplayName="Draw", Category="SenseGlove | Debug | Virtual Hand",
meta=(WorldContext="WorldContextObject"))
static void Draw_FXRHandTrackingState(
@@ -110,14 +110,6 @@ USGHapticGlove* UVirtualHandComponentKismetLibrary::GetConnectedGlove(
return VirtualHandComponent->GetConnectedGlove();
}
const FXRMotionControllerData& UVirtualHandComponentKismetLibrary::GetMotionControllerData(
USGVirtualHandComponent* VirtualHandComponent)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
return VirtualHandComponent->GetMotionControllerData();
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
const FXRHandTrackingState& UVirtualHandComponentKismetLibrary::GetHandTrackingState(
USGVirtualHandComponent* VirtualHandComponent)
{
@@ -90,14 +90,6 @@ const FRotator& UWristTrackerComponentKismetLibrary::GetWristRotation(
return WristTrackerComponent->GetWristRotation();
}
const FXRMotionControllerData& UWristTrackerComponentKismetLibrary::GetMotionControllerData(
USGWristTrackerComponent* WristTrackerComponent)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
return WristTrackerComponent->GetMotionControllerData();
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
const FXRHandTrackingState& UWristTrackerComponentKismetLibrary::GetHandTrackingState(
USGWristTrackerComponent* WristTrackerComponent)
{
@@ -102,10 +102,6 @@ public:
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Virtual Hand Component")
static USGHapticGlove* GetConnectedGlove(const USGVirtualHandComponent* VirtualHandComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
static const FXRMotionControllerData& GetMotionControllerData(
UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Virtual Hand Component")
static const FXRHandTrackingState& GetHandTrackingState(
UPARAM(ref) USGVirtualHandComponent* VirtualHandComponent);
@@ -83,10 +83,6 @@ public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static const FRotator& GetWristRotation(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static const FXRMotionControllerData& GetMotionControllerData(
UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static const FXRHandTrackingState& GetHandTrackingState(
UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent);
@@ -650,6 +650,10 @@ struct FSGXRTracker::FImpl
void BuildMotionSourceToKeypointMap();
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7
void CreateHandTracker(XrSession InSession, XrHandEXT HandEXT, FSGXRHandState& HandState) const;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7 */
bool CanOutputTrackingData(EControllerHand Hand) const;
bool UpdateXRHandTrackingData(FSGXRHandState& OutHandState, const XrHandJointsLocateInfoEXT& LocateInfo) const;
@@ -1009,231 +1013,6 @@ FTransform FSGXRTracker::FImpl::GetMeshFingerStartBoneRefTransform(
return Transform;
}
bool FSGXRTracker::GetMotionControllerData(
UObject* WorldContextObject,
const EControllerHand Hand,
FXRMotionControllerData& OutMotionControllerData)
{
OutMotionControllerData.DeviceName = NAME_None;
OutMotionControllerData.ApplicationInstanceID = FApp::GetInstanceId();
OutMotionControllerData.DeviceVisualType = EXRVisualType::Controller;
OutMotionControllerData.TrackingStatus = ETrackingStatus::NotTracked;
OutMotionControllerData.HandIndex = Hand;
OutMotionControllerData.bValid = false;
if (!IsValid(WorldContextObject))
{
return false;
}
IXRTrackingSystem* XRTrackingSystem{GEngine ? GEngine->XRSystem.Get() : nullptr};
if (!XRTrackingSystem)
{
return false;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
IOpenXRHMD* OpenXRHMD{XRTrackingSystem->GetIOpenXRHMD()};
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
FOpenXRHMD* OpenXRHMD{static_cast<FOpenXRHMD*>(GEngine->XRSystem.Get())};
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
if (!OpenXRHMD)
{
return false;
}
TArray<int32> Devices;
const int32 HandIndex = static_cast<int32>(Hand);
const bool bGotDevices =
XRTrackingSystem->EnumerateTrackedDevices(Devices, EXRTrackedDeviceType::Controller);
if (bGotDevices && Devices.IsValidIndex(HandIndex))
{
const XrSession Session{OpenXRHMD->GetSession()};
if (Session)
{
XrInteractionProfileState Profile = {XR_TYPE_INTERACTION_PROFILE_STATE};
const XrPath TopLevelUserPath{OpenXRHMD->GetTrackedDevicePath(Devices[HandIndex])};
const XrResult CurrentInteractionProfile{
xrGetCurrentInteractionProfile(Session, TopLevelUserPath, &Profile)
};
if (XR_SUCCEEDED(CurrentInteractionProfile) && Profile.interactionProfile != XR_NULL_PATH)
{
OutMotionControllerData.DeviceName = FOpenXRPath(Profile.interactionProfile);
}
}
}
static const FName HandTrackerName{"OpenXRHandTracking"};
TArray<IHandTracker*> HandTrackers = IModularFeatures::Get().GetModularFeatureImplementations<IHandTracker>(
IHandTracker::GetModularFeatureName());
IHandTracker* HandTracker{nullptr};
for (IHandTracker* HandTrackerIterator: HandTrackers)
{
if (!HandTrackerIterator)
{
continue;
}
const FName DeviceTypeName{HandTrackerIterator->GetHandTrackerDeviceTypeName()};
if (DeviceTypeName != HandTrackerName)
{
continue;
}
FSGXRTracker* SGXRTracker{static_cast<FSGXRTracker*>(HandTrackerIterator)};
if (!SGXRTracker)
{
continue;
}
HandTracker = SGXRTracker;
break;
}
if (Hand == EControllerHand::Left || Hand == EControllerHand::Right)
{
static const FName MotionControllerName("OpenXR");
TArray<IMotionController*> MotionControllers{
IModularFeatures::Get().GetModularFeatureImplementations<IMotionController>(
IMotionController::GetModularFeatureName())
};
IMotionController* MotionController{nullptr};
for (IMotionController* MotionControllerIterator: MotionControllers)
{
if (!MotionControllerIterator)
{
continue;
}
const FName DeviceTypeName{MotionControllerIterator->GetMotionControllerDeviceTypeName()};
if (DeviceTypeName != MotionControllerName)
{
continue;
}
MotionController = MotionControllerIterator;
break;
}
const float WorldToMeters = XRTrackingSystem->GetWorldToMetersScale();
if (MotionController)
{
const FTransform TrackingToWorld{XRTrackingSystem->GetTrackingToWorldTransform()};
{
const FName AimSource{Hand == EControllerHand::Left ? FName{TEXT("LeftAim")} : FName{TEXT("RightAim")}};
FRotator AimSourceRotation;
FVector AimSourcePosition;
const bool bGotAimOrientationAndPosition =
MotionController->GetControllerOrientationAndPosition(
0, AimSource, AimSourceRotation, AimSourcePosition, WorldToMeters);
if (bGotAimOrientationAndPosition)
{
OutMotionControllerData.AimPosition = TrackingToWorld.TransformPosition(AimSourcePosition);
OutMotionControllerData.AimRotation =
TrackingToWorld.TransformRotation(AimSourceRotation.Quaternion());
}
OutMotionControllerData.bValid |= bGotAimOrientationAndPosition;
}
const FName GripSource{Hand == EControllerHand::Left ? FName{TEXT("LeftGrip")} : FName{TEXT("RightGrip")}};
{
FRotator GripRotation;
FVector GripPosition;
const bool bGotGripSourceOrientationAndPosition =
MotionController->GetControllerOrientationAndPosition(
0, GripSource, GripRotation, GripPosition, WorldToMeters);
if (bGotGripSourceOrientationAndPosition)
{
OutMotionControllerData.GripPosition = TrackingToWorld.TransformPosition(GripPosition);
OutMotionControllerData.GripRotation =
TrackingToWorld.TransformRotation(GripRotation.Quaternion());
}
OutMotionControllerData.bValid |= bGotGripSourceOrientationAndPosition;
}
{
const FName PalmSource{
Hand == EControllerHand::Left ? FName{TEXT("LeftPalm")} : FName{TEXT("RightPalm")}
};
FRotator PalmRotation;
FVector PalmPosition;
const bool bGotPalmOrientationAndPosition = MotionController->GetControllerOrientationAndPosition(
0, PalmSource, PalmRotation, PalmPosition, WorldToMeters);
if (bGotPalmOrientationAndPosition)
{
OutMotionControllerData.GripPosition = TrackingToWorld.TransformPosition(PalmPosition);
OutMotionControllerData.GripRotation =
TrackingToWorld.TransformRotation(PalmRotation.Quaternion());
}
OutMotionControllerData.bValid |= bGotPalmOrientationAndPosition;
}
OutMotionControllerData.TrackingStatus = MotionController->GetControllerTrackingStatus(0, GripSource);
}
const bool bHandTrackingStateValid = HandTracker && HandTracker->IsHandTrackingStateValid();
if (bHandTrackingStateValid)
{
OutMotionControllerData.DeviceVisualType = EXRVisualType::Hand;
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
bool bTracked = false;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
OutMotionControllerData.bValid = HandTracker->GetAllKeypointStates(
Hand,
OutMotionControllerData.HandKeyPositions,
OutMotionControllerData.HandKeyRotations,
OutMotionControllerData.HandKeyRadii
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
, bTracked
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
// Unused!
(void) bTracked;
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
// TODO
// Begin backward compatibility with the deprecated function, remove this block along with the deprecated
// GetAllKeypointStates (though it should be time to remove this entire function as well)!
if (!OutMotionControllerData.bValid)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
OutMotionControllerData.bValid = HandTracker->GetAllKeypointStates(
Hand,
OutMotionControllerData.HandKeyPositions,
OutMotionControllerData.HandKeyRotations,
OutMotionControllerData.HandKeyRadii);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
// End backward compability.
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */
if (!ensureAlwaysMsgf(
!OutMotionControllerData.bValid
|| (OutMotionControllerData.HandKeyPositions.Num() == EHandKeypointCount
&& OutMotionControllerData.HandKeyRotations.Num() == EHandKeypointCount
&& OutMotionControllerData.HandKeyRadii.Num() == EHandKeypointCount),
TEXT("Corrupted OutMotionControllerData!")))
{
OutMotionControllerData.bValid = false;
return false;
}
}
}
if (OutMotionControllerData.bValid)
{
OutMotionControllerData.TrackingStatus = ETrackingStatus::Tracked;
}
return OutMotionControllerData.bValid;
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
bool FSGXRTracker::GetMotionControllerState(
@@ -1478,6 +1257,7 @@ bool FSGXRTracker::GetHandTrackingState(
OutHandTrackingState.HandKeyRadii,
bTracked);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7
/// TODO
// Begin backward compatibility with the deprecated function, remove this block along with the deprecated
// GetAllKeypointStates.
@@ -1494,6 +1274,7 @@ bool FSGXRTracker::GetHandTrackingState(
// The inability to distinguish this is the reason for the deprecation.
}
// End backward compability.
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION < 7 */
if (!ensureAlwaysMsgf(
!OutHandTrackingState.bValid
@@ -1589,7 +1370,7 @@ bool FSGXRTracker::GetRequiredExtensions(TArray<const ANSICHAR*>& OutExtensions)
}
}
OutExtensions.Add("XR_EXT_hand_tracking");
OutExtensions.Add(XR_EXT_HAND_TRACKING_EXTENSION_NAME);
return true;
}
@@ -1638,21 +1419,29 @@ const void* FSGXRTracker::OnBeginSession(const XrSession InSession, const void*
// Create a hand tracker for the left hand that tracks default set of hand joints.
FSGXRHandState& LeftHandState{Pimpl->GetLeftHandState()};
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7
Pimpl->CreateHandTracker(InSession, XR_HAND_LEFT_EXT, LeftHandState);
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7 */
{
XrHandTrackerCreateInfoEXT CreateInfo{XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT};
CreateInfo.hand = XR_HAND_LEFT_EXT;
CreateInfo.handJointSet = XR_HAND_JOINT_SET_DEFAULT_EXT;
XR_ENSURE(Pimpl->XRCreateHandTrackerEXT(InSession, &CreateInfo, &LeftHandState.HandTracker));
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7 */
// Create a hand tracker for the right hand that tracks default set of hand joints.
FSGXRHandState& RightHandState{Pimpl->GetRightHandState()};
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7
Pimpl->CreateHandTracker(InSession, XR_HAND_RIGHT_EXT, RightHandState);
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7 */
{
XrHandTrackerCreateInfoEXT CreateInfo{XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT};
CreateInfo.hand = XR_HAND_RIGHT_EXT;
CreateInfo.handJointSet = XR_HAND_JOINT_SET_DEFAULT_EXT;
XR_ENSURE(Pimpl->XRCreateHandTrackerEXT(InSession, &CreateInfo, &RightHandState.HandTracker));
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7 */
}
return InNext;
@@ -2030,6 +1819,27 @@ void FSGXRTracker::FImpl::BuildMotionSourceToKeypointMap()
RightHandSGMotionSourceName, FSGMotionSourceInfo(EHandKeypoint::Wrist, false));
}
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7
void FSGXRTracker::FImpl::CreateHandTracker(XrSession InSession, XrHandEXT HandEXT, FSGXRHandState& HandState) const
{
XrHandTrackerCreateInfoEXT CreateInfo{XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT};
CreateInfo.hand = HandEXT;
CreateInfo.handJointSet = XR_HAND_JOINT_SET_DEFAULT_EXT;
IOpenXRHMD* OpenXRHMD{XRTrackingSystem ? XRTrackingSystem->GetIOpenXRHMD() : nullptr};
if (OpenXRHMD)
{
TArray<IOpenXRExtensionPlugin*> ExtensionPlugins{OpenXRHMD->GetExtensionPlugins()};
for (IOpenXRExtensionPlugin* Plugin : ExtensionPlugins)
{
CreateInfo.next = Plugin->OnCreateHandTracker(CreateInfo.next);
}
}
XR_ENSURE(XRCreateHandTrackerEXT(InSession, &CreateInfo, &HandState.HandTracker));
}
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 7 */
bool FSGXRTracker::FImpl::CanOutputTrackingData(const EControllerHand Hand) const
{
const bool bFallbackToHandTrackingIfNoGloveDetected = ShouldFallbackToHandTrackingIfNoGloveDetected();
@@ -55,12 +55,6 @@ class SENSEGLOVETRACKING_API FSGXRTracker final : public IOpenXRExtensionPlugin,
public IHandTracker
{
public:
UE_DEPRECATED(5.5, "Deprecated by UE 5.5 in favor of GetMotionControllerState and GetHandTrackingState")
static bool GetMotionControllerData(
UObject* WorldContextObject,
EControllerHand Hand,
FXRMotionControllerData& OutMotionControllerData);
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5
static bool GetMotionControllerState(
UObject* WorldContextObject,
@@ -39,14 +39,6 @@
#include "SGTracking/SGXRTracker.h"
bool USGXRTrackerKismetLibrary::GetMotionControllerData(
UObject* WorldContextObject, const EControllerHand Hand, FXRMotionControllerData& OutMotionControllerData)
{
PRAGMA_DISABLE_DEPRECATION_WARNINGS
return FSGXRTracker::GetMotionControllerData(WorldContextObject, Hand, OutMotionControllerData);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}
bool USGXRTrackerKismetLibrary::GetMotionControllerState(
UObject* WorldContextObject,
const EXRSpaceType XRSpaceType, const EControllerHand Hand, const EXRControllerPoseType XRControllerPoseType,
@@ -51,13 +51,6 @@ class SENSEGLOVETRACKINGKISMET_API USGXRTrackerKismetLibrary final : public USGB
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category="SenseGlove | Tracking | XR Tracker",
meta=(WorldContext="WorldContextObject"))
static bool GetMotionControllerData(
UObject* WorldContextObject,
EControllerHand Hand,
FXRMotionControllerData& OutMotionControllerData);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Tracking | XR Tracker",
meta=(WorldContext="WorldContextObject"))
static bool GetMotionControllerState(