Download

MotionSource/Hand and EDeviceType 4.19

So we have recently grabbed the 4.19 release and have noticed a few errors and we are trying to work out if there is a new/improved way to get a players hand and headset type they are using or if we are expected to be using FName instead of set enum values.

Pre-4.19, Motion controllers had a ‘Hand’ variable, which has since been deprecated and now uses MotionSource which is an FName. I’m not entirely sure why it was needed to be changed from a set enum to an FName, but I have found ‘FXRMotionControllerBase::RightHandSourceId’ in the Engine being used. Is this the correct way to check if the motion controller is set to right or left handed?

MotionSource == FXRMotionControllerBase::RightHandSourceId

Another one that we have seen is the GetHMDDeviceType which used to return a ‘EHMDDeviceType::Type’ now doesn’t seem to be used and the best approach I found was:

FName SystemName = GEngine->XRSystem->GetSystemName();
if (SystemName == OculusHMD::FOculusHMD::OculusSystemName (Or other system name here))

Was wondering if anyone else had also experienced issues with these changes or perhaps someone from Epic could let me know the best approach to now use, especially with getting what type of HMD the user is wearing.

const FName SourceRight = TEXT(“Right”);

if (MyController->MotionSource == SourceRight) …

Why FName instead of enum? I can’t explain.

Although using FXRMotionControllerBase::RightHandSourceId is more corrrrect way.

For what it’s worth…
Epic updated the the 4.19 BP_MotionController template with the new distro. The template still uses ‘Hand’. When I compile with the 4.18 template I get a warning that the function ‘SetHand()’ is deprecated. It appears to be just the function not the whole object. In the 4.19 BP_MotionController Constructor they grab the hand enumerator, convert it to a name and put it in the MotionControllers’s MotionSource. (see photo.) The use of 'GetHand() in the rest of the blueprint was not changed.
Removing the Setter is a common way for the system architect to communicate that the system will set the value for you, then you can use it.