To get the data for the hand rays, you should use the Get Motion Controller Data function from the previous section. The returned structure contains two parameters you can use to create a hand ray – Aim Position and Aim Rotation. These parameters form a ray directed by your elbow. You should take them and find a hologram being pointed by.
Below is an example of determining whether a hand ray hits a Widget and setting a custom hit result:
To use Hand Rays in Blueprints, search for any of the actions under Windows Mixed Reality HMD:
To access them in C++, include WindowsMixedRealityFunctionLibrary.h
to the top of your calling code file.
You also have access to input cases under EHMDInputControllerButtons, which can be used in Blueprints:
For access in C++, use the EHMDInputControllerButtons
enum class:
enum class EHMDInputControllerButtons : uint8
{
Select,
Grasp,
//......
};
Below is a breakdown of the two applicable enum cases:
You can access the tracking status of your hand mesh in C++ through the EHMDTrackingStatus
enum shown below:
enum class EHMDTrackingStatus : uint8
{
NotTracked,
//......
Tracked
};
Below is a breakdown of the two applicable enum cases:
The PointerPoseInfo struct can give you information on the following hand data:
You can access the PointerPoseInfo struct through Blueprints, as shown below:
Or with C++:
struct FPointerPoseInfo
{
FVector Origin;
FVector Direction;
FVector Up;
FQuat Orientation;
EHMDTrackingStatus TrackingStatus;
};
All of the functions listed below can be called on every frame, which allows continuous monitoring.
Blueprint:
C++:
static FPointerPoseInfo UWindowsMixedRealityFunctionLibrary::GetPointerPoseInfo(EControllerHand hand);
Blueprint:
C++:
static bool UWindowsMixedRealityFunctionLibrary::IsGrasped(EControllerHand hand);
Blueprint:
C++:
static bool UWindowsMixedRealityFunctionLibrary::IsSelectPressed(EControllerHand hand);
Blueprint:
C++:
static bool UWindowsMixedRealityFunctionLibrary::IsButtonClicked(EControllerHand hand, EHMDInputControllerButtons button);
Blueprint:
C++:
static EHMDTrackingStatus UWindowsMixedRealityFunctionLibrary::GetControllerTrackingStatus(EControllerHand hand);