make FSGXRTracker::GetMotionControllerData() behave the same as 5.4 on both 5.2 and 5.3

This commit is contained in:
Mamadou Babaei
2024-08-16 18:00:57 +02:00
parent 920c126a41
commit 246673de5f
3 changed files with 27 additions and 8 deletions
@@ -41,12 +41,15 @@
#include "Engine/SkeletalMesh.h"
#include "Engine/World.h"
#include "GameFramework/WorldSettings.h"
#if ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4
#include "IOpenXRHMD.h"
#endif /* ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4 */
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 4 */
#include "IOpenXRHMDModule.h"
#include "IXRTrackingSystem.h"
#include "OpenXRCore.h"
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 3
#include "OpenXRHMD.h"
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION <= 3 */
#include "Runtime/Launch/Resources/Version.h"
#include "SGCore/SGHapticGlove.h"
@@ -996,8 +999,11 @@ bool FSGXRTracker::GetMotionControllerData(
return false;
}
#if ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4
#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;
@@ -1158,9 +1164,6 @@ bool FSGXRTracker::GetMotionControllerData(
/// TODO
// This is reportedly a WMR-specific convenience function for rapid prototyping. Not sure if it's useful for OpenXR.
OutMotionControllerData.bIsGrasped = false;
#else /* ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4 */
XRTrackingSystem->GetMotionControllerData(WorldContextObject, Hand, OutMotionControllerData);
#endif /* ENGINE_MAJOR_VERSION > 5 && ENGINE_MINOR_VERSION >= 4 */
return OutMotionControllerData.bValid;
}