utilize UXRDeviceVisualizationComponent to display meshes on UE 5.2 onwards
This commit is contained in:
@@ -31,6 +31,7 @@ This is the second major release of the SenseGlove Unreal Engine Plugin adding s
|
||||
- The SGTouchComponent uproperties BuzzDuration and BuzzLevel now utilize different different names in order to correspond to the underlying API changes. They have been renamed to VibrotactileDuration and VibrotacktileLevel.
|
||||
- The SGTouchComponent uproperties ForceFeedbackLevel and BuzzLevel (now VibrotacktileLevel) parameters type have changed from int32 to float with the value range varying between 0.0f to 1.0f instead of 1 to 100 in order to correspond to the underlying API changes.
|
||||
- The SGVirtualHandComponent now assumes the default grab point's name as GenericGrabPoint instead of GrabPoint as default if not specified in the Unreal Blueprint Editor.
|
||||
- The SGPawn on UE 5.2+ now utilizes UXRDeviceVisualizationComponent in order to properly display the controller meshes shipped with Unreal Engine's OpenXR plugin, or a user-provided mesh. On UE 5.1 this could still be set on the WristTrackerLeft and WristTrackerRight components. Please note that despite the fact that on UE 5.2+ it's still possible to utilize the WristTrackerLeft and WristTrackerRight for setting the controller meshes, this has been deprecated in UE 5.2+ and is no longer supported.
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
#include "Components/PrimitiveComponent.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Runtime/Launch/Resources/Version.h"
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
#include "XRDeviceVisualizationComponent.h"
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
#include "UObject/UObjectGlobals.h"
|
||||
|
||||
#include "SenseGlove/Components/SGGrabComponent.h"
|
||||
@@ -173,6 +175,15 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
|
||||
WristTrackerLeft->SetupAttachment(GetRootComponent());
|
||||
WristTrackerLeft->SetRight(false);
|
||||
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
ControllerVisualizerLeft = ObjectInitializer.CreateDefaultSubobject<UXRDeviceVisualizationComponent>(
|
||||
this, TEXT("ControllerVisualizerLeft"));
|
||||
ControllerVisualizerLeft->SetupAttachment(WristTrackerLeft);
|
||||
ControllerVisualizerLeft->SetDisplayModelSource(FName("OpenXR"));
|
||||
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
WristTrackerLeft->SetDisplayModelSource(FName("OpenXR"));
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
|
||||
HandLeft = ObjectInitializer.CreateDefaultSubobject<USGVirtualHandComponent>(this, TEXT("HandLeft"));
|
||||
HandLeft->SetupAttachment(GetRootComponent());
|
||||
HandLeft->SetCanEverAffectNavigation(false);
|
||||
@@ -391,6 +402,15 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
|
||||
WristTrackerRight->SetupAttachment(GetRootComponent());
|
||||
WristTrackerRight->SetRight(true);
|
||||
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
ControllerVisualizerRight = ObjectInitializer.CreateDefaultSubobject<UXRDeviceVisualizationComponent>(
|
||||
this, TEXT("ControllerVisualizerRight"));
|
||||
ControllerVisualizerRight->SetupAttachment(WristTrackerRight);
|
||||
ControllerVisualizerRight->SetDisplayModelSource(FName("OpenXR"));
|
||||
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
WristTrackerRight->SetDisplayModelSource(FName("OpenXR"));
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
|
||||
HandRight = ObjectInitializer.CreateDefaultSubobject<USGVirtualHandComponent>(this, TEXT("HandRight"));
|
||||
HandRight->SetupAttachment(GetRootComponent());
|
||||
HandRight->SetCanEverAffectNavigation(false);
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "TimerManager.h"
|
||||
|
||||
#include "SenseGlove/Components/SGTouchComponent.h"
|
||||
#include "SenseGlove/Components/SGVirtualHandComponent.h"
|
||||
#include "SenseGlove/GameFramework/SGPawn.h"
|
||||
#include "SenseGlove/Haptics/SGGrabState.h"
|
||||
#include "SenseGlove/Haptics/SGTouchState.h"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include "Containers/Array.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "SenseGlove/Components/SGVirtualHandComponent.h"
|
||||
#include "Runtime/Launch/Resources/Version.h"
|
||||
#include "Templates/UniquePtr.h"
|
||||
|
||||
#include "SenseGlove/Haptics/SGGrabState.h"
|
||||
@@ -48,6 +48,7 @@
|
||||
class UCameraComponent;
|
||||
class UPrimitiveComponent;
|
||||
class USphereComponent;
|
||||
class UXRDeviceVisualizationComponent;
|
||||
|
||||
class USGVirtualHandComponent;
|
||||
class USGWristTrackerComponent;
|
||||
@@ -129,6 +130,9 @@ private:
|
||||
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
USGWristTrackerComponent* WristTrackerLeft;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
UXRDeviceVisualizationComponent* ControllerVisualizerLeft;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
USGVirtualHandComponent* HandLeft;
|
||||
|
||||
@@ -162,6 +166,9 @@ private:
|
||||
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
USGWristTrackerComponent* WristTrackerRight;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
UXRDeviceVisualizationComponent* ControllerVisualizerRight;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category="SenseGlove", meta=(AllowPrivateAccess="false"))
|
||||
USGVirtualHandComponent* HandRight;
|
||||
|
||||
@@ -244,6 +251,13 @@ public:
|
||||
return WristTrackerLeft;
|
||||
}
|
||||
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
FORCEINLINE UXRDeviceVisualizationComponent* GetControllerVisualizerLeft() const
|
||||
{
|
||||
return ControllerVisualizerLeft;
|
||||
}
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
|
||||
FORCEINLINE USGVirtualHandComponent* GetHandLeft() const
|
||||
{
|
||||
return HandLeft;
|
||||
@@ -299,6 +313,13 @@ public:
|
||||
return WristTrackerRight;
|
||||
}
|
||||
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
FORCEINLINE UXRDeviceVisualizationComponent* GetControllerVisualizerRight() const
|
||||
{
|
||||
return ControllerVisualizerLeft;
|
||||
}
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
|
||||
FORCEINLINE USGVirtualHandComponent* GetHandRight() const
|
||||
{
|
||||
return HandRight;
|
||||
|
||||
@@ -57,6 +57,13 @@ public class SenseGlove : ModuleRules
|
||||
"Engine",
|
||||
"HeadMountedDisplay",
|
||||
"InputCore",
|
||||
// NOTE
|
||||
// UE 5.3+ provides UXRDeviceVisualizationComponent as part of the XRBase plugin.
|
||||
// UE 5.2 provides UXRDeviceVisualizationComponent as part of the HeadMountDisplay module.
|
||||
// UE 5.1 does not provide the UXRDeviceVisualizationComponent type.
|
||||
#if UE_5_3_OR_LATER
|
||||
"XRBase",
|
||||
#endif
|
||||
"SenseGloveBackend",
|
||||
"SenseGloveConnect",
|
||||
"SenseGloveCore",
|
||||
@@ -74,4 +81,4 @@ public class SenseGlove : ModuleRules
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,13 @@
|
||||
|
||||
#include "SGKismet/SGPawnKismetLibrary.h"
|
||||
|
||||
#include "Runtime/Launch/Resources/Version.h"
|
||||
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
#include "XRDeviceVisualizationComponent.h"
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
|
||||
#include "SenseGlove/Components/SGVirtualHandComponent.h"
|
||||
#include "SenseGlove/Components/SGWristTrackerComponent.h"
|
||||
@@ -52,6 +57,15 @@ USGWristTrackerComponent* UPawnKismetLibrary::GetWristTrackerLeft(const ASGPawn*
|
||||
return Pawn->GetWristTrackerLeft();
|
||||
}
|
||||
|
||||
UXRDeviceVisualizationComponent* UPawnKismetLibrary::GetControllerVisualizerLeft(const ASGPawn* Pawn)
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
return Pawn->GetControllerVisualizerLeft();
|
||||
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
return nullptr;
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
}
|
||||
|
||||
USGVirtualHandComponent* UPawnKismetLibrary::GetHandLeft(const ASGPawn* Pawn)
|
||||
{
|
||||
return Pawn->GetHandLeft();
|
||||
@@ -107,6 +121,15 @@ USGWristTrackerComponent* UPawnKismetLibrary::GetWristTrackerRight(const ASGPawn
|
||||
return Pawn->GetWristTrackerRight();
|
||||
}
|
||||
|
||||
UXRDeviceVisualizationComponent* UPawnKismetLibrary::GetControllerVisualizerRight(const ASGPawn* Pawn)
|
||||
{
|
||||
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2
|
||||
return Pawn->GetControllerVisualizerRight();
|
||||
#else /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
return nullptr;
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
}
|
||||
|
||||
USGVirtualHandComponent* UPawnKismetLibrary::GetHandRight(const ASGPawn* Pawn)
|
||||
{
|
||||
return Pawn->GetHandRight();
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
class UCameraComponent;
|
||||
class USphereComponent;
|
||||
class UXRDeviceVisualizationComponent;
|
||||
|
||||
class ASGPawn;
|
||||
class USGVirtualHandComponent;
|
||||
@@ -68,6 +69,9 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
|
||||
static USGWristTrackerComponent* GetWristTrackerLeft(const ASGPawn* Pawn);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
|
||||
static UXRDeviceVisualizationComponent* GetControllerVisualizerLeft(const ASGPawn* Pawn);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
|
||||
static USGVirtualHandComponent* GetHandLeft(const ASGPawn* Pawn);
|
||||
|
||||
@@ -101,6 +105,9 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
|
||||
static USGWristTrackerComponent* GetWristTrackerRight(const ASGPawn* Pawn);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
|
||||
static UXRDeviceVisualizationComponent* GetControllerVisualizerRight(const ASGPawn* Pawn);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category="SenseGlove | Game Framework | Pawn")
|
||||
static USGVirtualHandComponent* GetHandRight(const ASGPawn* Pawn);
|
||||
|
||||
|
||||
@@ -55,6 +55,13 @@ public class SenseGloveKismet : ModuleRules
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
"HeadMountedDisplay",
|
||||
// NOTE
|
||||
// UE 5.3+ provides UXRDeviceVisualizationComponent as part of the XRBase plugin.
|
||||
// UE 5.2 provides UXRDeviceVisualizationComponent as part of the HeadMountDisplay module.
|
||||
// UE 5.1 does not provide the UXRDeviceVisualizationComponent type.
|
||||
#if UE_5_3_OR_LATER
|
||||
"XRBase",
|
||||
#endif
|
||||
"SenseGlove",
|
||||
"SenseGloveCore",
|
||||
"SenseGloveLog",
|
||||
|
||||
Reference in New Issue
Block a user