fix a bug where SteamVR trackers such as HTC VIVE and HTC VIVE Focus 3's wrist orientation and location were not being tracked.

This commit is contained in:
Mamadou Babaei
2023-06-16 02:12:00 +02:00
parent 76076d1339
commit 0f8197efeb
7 changed files with 89 additions and 5 deletions
+6 -1
View File
@@ -13,12 +13,17 @@ This release breaks ABI/API compatibility with the previous versions in some are
- Added support for the Meta Quest Pro positional tracking hardware. - Added support for the Meta Quest Pro positional tracking hardware.
- Added HTC VIVE Focus 3 positional tracking hardware enum, though it has not been implemented, yet. - Added HTC VIVE Focus 3 positional tracking hardware enum, though it has not been implemented, yet.
- Added two options to the wrist tracker component in order to be able to specify a custom motion source for the left and right hands in order to enable SteamVR-based trackers such as HTC VIVE or HTC VIVE Focus 3 to work.
### Fixed
- Fix a bug where SteamVR trackers such as HTC VIVE and HTC VIVE Focus 3's wrist orientation and location were not being tracked.
### Changed ### Changed
- Fully refactored the top-level configurations in the settings system into USTRUCTs. - Fully refactored the top-level configurations in the settings system into USTRUCTs.
- SenseGlove libraries have been updated to v2.9.0-21c54c5. - SenseGlove libraries have been updated to v2.9.0-21c54c5.
- Change HTC VIVE Tracker enum's display name in order to clarify it has not been implemented, yet. - Change the HTC VIVE Tracker enum's display name in order to clarify it has not been implemented, yet.
### Removed ### Removed
@@ -106,6 +106,9 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
SetReceivesDecals(false); SetReceivesDecals(false);
SetCanEverAffectNavigation(false); SetCanEverAffectNavigation(false);
LeftHandMotionSource = EControllerHand::Left;
RightHandMotionSource = EControllerHand::Right;
SetRight(true); SetRight(true);
bOverridePluginWristTrackingSettings = false; bOverridePluginWristTrackingSettings = false;
@@ -152,7 +155,7 @@ void USGWristTrackerComponent::SetWristTrackingSettings(const FSGWristTrackingSe
void USGWristTrackerComponent::SetRight(const bool bRight) void USGWristTrackerComponent::SetRight(const bool bRight)
{ {
SetTrackingSource(bRight ? EControllerHand::Right : EControllerHand::Left); SetTrackingSource(bRight ? GetRightHandMotionSource() : GetLeftHandMotionSource());
} }
#if WITH_EDITOR #if WITH_EDITOR
@@ -36,6 +36,7 @@
#pragma once #pragma once
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "InputCoreTypes.h"
#include "Math/Rotator.h" #include "Math/Rotator.h"
#include "Math/Vector.h" #include "Math/Vector.h"
#include "MotionControllerComponent.h" #include "MotionControllerComponent.h"
@@ -94,6 +95,20 @@ private:
FImplDeleter PimplDeleter; FImplDeleter PimplDeleter;
private: private:
/**
* Determines which motion source to use.
* For Oculus this is usually Left, and for VIVE usually LeftFoot.
*/
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
EControllerHand LeftHandMotionSource;
/**
* Determines which motion source to use.
* For Oculus this is usually Right, and for VIVE usually RightFoot.
*/
UPROPERTY(EditAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
EControllerHand RightHandMotionSource;
/** /**
* Determines whether to override the plugin's wrist tracking settings or not. * Determines whether to override the plugin's wrist tracking settings or not.
*/ */
@@ -121,6 +136,26 @@ private:
FRotator WristRotation; FRotator WristRotation;
public: public:
FORCEINLINE EControllerHand GetLeftHandMotionSource() const
{
return LeftHandMotionSource;
}
void SetLeftHandMotionSource(const EControllerHand InLeftHandMotionSource)
{
LeftHandMotionSource = InLeftHandMotionSource;
}
FORCEINLINE EControllerHand GetRightHandMotionSource() const
{
return RightHandMotionSource;
}
void SetRightHandMotionSource(const EControllerHand InRightHandMotionSource)
{
RightHandMotionSource = InRightHandMotionSource;
}
FORCEINLINE bool OverridesPluginWristTrackingSettings() const FORCEINLINE bool OverridesPluginWristTrackingSettings() const
{ {
return !!bOverridePluginWristTrackingSettings; return !!bOverridePluginWristTrackingSettings;
@@ -136,12 +171,12 @@ public:
FORCEINLINE bool IsLeft() const FORCEINLINE bool IsLeft() const
{ {
return GetTrackingSource() == EControllerHand::Left; return GetTrackingSource() == GetLeftHandMotionSource();
} }
FORCEINLINE bool IsRight() const FORCEINLINE bool IsRight() const
{ {
return GetTrackingSource() == EControllerHand::Right; return GetTrackingSource() == GetRightHandMotionSource();
} }
void SetRight(const bool bRight); void SetRight(const bool bRight);
+1
View File
@@ -56,6 +56,7 @@ public class SenseGlove : ModuleRules
"CoreUObject", "CoreUObject",
"Engine", "Engine",
"HeadMountedDisplay", "HeadMountedDisplay",
"InputCore",
"SenseGloveConnect", "SenseGloveConnect",
"SenseGloveCore", "SenseGloveCore",
"SenseGloveDebug", "SenseGloveDebug",
@@ -37,6 +37,30 @@
#include "SenseGlove/Components/SGWristTrackerComponent.h" #include "SenseGlove/Components/SGWristTrackerComponent.h"
EControllerHand UWristTrackerComponentKismetLibrary::GetLeftHandMotionSource(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetLeftHandMotionSource();
}
void UWristTrackerComponentKismetLibrary::SetLeftHandMotionSource(
USGWristTrackerComponent* WristTrackerComponent, const EControllerHand InLeftHandMotionSource)
{
WristTrackerComponent->SetLeftHandMotionSource(InLeftHandMotionSource);
}
EControllerHand UWristTrackerComponentKismetLibrary::GetRightHandMotionSource(
const USGWristTrackerComponent* WristTrackerComponent)
{
return WristTrackerComponent->GetRightHandMotionSource();
}
void UWristTrackerComponentKismetLibrary::SetRightHandMotionSource(
USGWristTrackerComponent* WristTrackerComponent, const EControllerHand InRightHandMotionSource)
{
WristTrackerComponent->SetRightHandMotionSource(InRightHandMotionSource);
}
bool UWristTrackerComponentKismetLibrary::OverridesPluginWristTrackingSettings( bool UWristTrackerComponentKismetLibrary::OverridesPluginWristTrackingSettings(
const USGWristTrackerComponent* WristTrackerComponent) const USGWristTrackerComponent* WristTrackerComponent)
{ {
@@ -37,8 +37,9 @@
#pragma once #pragma once
#include "SGKismet/SGBlueprintFunctionLibrary.h" #include "InputCoreTypes.h"
#include "SGKismet/SGBlueprintFunctionLibrary.h"
#include "SGSettings/SGWristTrackingSettings.h" #include "SGSettings/SGWristTrackingSettings.h"
#include "SGWristTrackerComponentKismetLibrary.generated.h" #include "SGWristTrackerComponentKismetLibrary.generated.h"
@@ -54,6 +55,20 @@ class SENSEGLOVEKISMET_API UWristTrackerComponentKismetLibrary final : public US
GENERATED_BODY() GENERATED_BODY()
public: public:
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static EControllerHand GetLeftHandMotionSource(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetLeftHandMotionSource(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
EControllerHand InLeftHandMotionSource);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static EControllerHand GetRightHandMotionSource(const USGWristTrackerComponent* WristTrackerComponent);
UFUNCTION(BlueprintCallable, Category="SenseGlove | Components | Wrist Tracker Component")
static void SetRightHandMotionSource(UPARAM(ref) USGWristTrackerComponent* WristTrackerComponent,
EControllerHand InRightHandMotionSource);
UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component") UFUNCTION(BlueprintPure, Category="SenseGlove | Components | Wrist Tracker Component")
static bool OverridesPluginWristTrackingSettings(const USGWristTrackerComponent* WristTrackerComponent); static bool OverridesPluginWristTrackingSettings(const USGWristTrackerComponent* WristTrackerComponent);
@@ -55,6 +55,7 @@ public class SenseGloveKismet : ModuleRules
"CoreUObject", "CoreUObject",
"Engine", "Engine",
"HeadMountedDisplay", "HeadMountedDisplay",
"InputCore",
"SenseGlove", "SenseGlove",
"SenseGloveCore", "SenseGloveCore",
"SenseGloveLog", "SenseGloveLog",