diff --git a/Handbook/src/appendix/changelog.md b/Handbook/src/appendix/changelog.md index df1500f5..83e5cf98 100644 --- a/Handbook/src/appendix/changelog.md +++ b/Handbook/src/appendix/changelog.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### [Unreleased] +### Added + +- A new `FSGDebugVirtualHand::Draw()` overload has been added to allow visualizing `FSGDebugGizmoSettings` directly. This is used internally by the new `USGHandTrackerComponent` to visualize its `FXRHandTrackingState` if `bVisualize` is enabled. + ### Fixed - Fix some copyright notices with wrong copyright owner. These propably has happend during bulk replaces with class or struct names. @@ -14,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - List existing SenseGlove components under `SenseGlove` `ClassGroup` inside Unreal's Blueprint Editor. This chagnes `ClassGroup` for `USGGrabComponent`, `USGTouchComponent`, `USGVirtualHandComponent`, and `USGWristTrackerComponent`. -- Force `USGVirtualHandComponent` and `USGWristTrackerComponent` to update their XR hand-tracking state when their handedness is updated. +- Force `USGVirtualHandComponent` and `USGWristTrackerComponent` to update their XR hand-tracking data when their handedness is updated. - Bumped the SenseGlove Unreal Engine Marketplace Packager to `v0.6.1-85c5a6e`. - Bumped the copyright years. diff --git a/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp b/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp index 28d2ed02..a381befb 100644 --- a/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp +++ b/Source/SenseGloveDebug/Private/SGDebug/SGDebugVirtualHand.cpp @@ -87,4 +87,33 @@ void FSGDebugVirtualHand::Draw( } } } + +void FSGDebugVirtualHand::Draw( + const UWorld* World, + const FXRHandTrackingState& HandTrackingState, + const FSGDebugGizmoSettings& Settings) +{ + if (!ensureAlwaysMsgf( + HandTrackingState.bValid, + TEXT("Invalid hand tracking state!"))) + { + return; + }; + + if (!ensureAlwaysMsgf( + HandTrackingState.HandKeyLocations.Num() == HandTrackingState.HandKeyRotations.Num(), + TEXT("Mismatched hand tracking state locations and rotations!"))) + { + return; + }; + + for (TArray::SizeType HandKeyIndex = 0; + HandKeyIndex < HandTrackingState.HandKeyLocations.Num(); ++HandKeyIndex) + { + const FVector& HandKeyLocation{HandTrackingState.HandKeyLocations[HandKeyIndex]}; + const FQuat& HandKeyRotation{HandTrackingState.HandKeyRotations[HandKeyIndex]}; + + FSGDebugGizmo::Draw(World, HandKeyLocation, HandKeyRotation, Settings); + } +} #endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ \ No newline at end of file diff --git a/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h b/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h index 47d5280a..18aa7c93 100644 --- a/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h +++ b/Source/SenseGloveDebug/Public/SGDebug/SGDebugVirtualHand.h @@ -53,6 +53,11 @@ public: const UWorld* World, const FXRHandTrackingState& HandTrackingState, const FSGVirtualHandDebuggingSettings& Settings); + + static void Draw( + const UWorld* World, + const FXRHandTrackingState& HandTrackingState, + const FSGDebugGizmoSettings& Settings); #endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 5 */ public: