Open 3D Engine OpenXRVk Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
Inherits XR::Input.
Public Member Functions | |
AZ_CLASS_ALLOCATOR (Input, AZ::SystemAllocator) | |
AZ_RTTI (Input, "{97ADD1FE-27DF-4F36-9F61-683F881F9477}", XR::Input) | |
bool | UpdateXrSpaceLocations (const OpenXRVk::Device &device, XrTime predictedDisplayTime, AZStd::vector< XrView > &xrViews) |
void | PollActions () |
AZ::RHI::ResultCode | InitializeActionSpace (XrSession xrSession) |
Create controller action spaces. | |
AZ::RHI::ResultCode | InitializeActionSets (XrSession xrSession) const |
Attach action sets. | |
void | LocateControllerSpace (XrTime predictedDisplayTime, XrSpace baseSpace, AZ::u32 handIndex) |
Updates a Controller/Joystick pose. | |
void | LocateVisualizedSpace (XrTime predictedDisplayTime, XrSpace space, XrSpace baseSpace, OpenXRVk::SpaceType visualizedSpaceType) |
Update pose information for the view. | |
AZ::RHI::ResultCode | GetControllerPose (AZ::u32 handIndex, AZ::RPI::PoseData &outPoseData, bool convertToO3de=true) const |
AZ::RHI::ResultCode | GetControllerTransform (AZ::u32 handIndex, AZ::Transform &outTransform, bool convertToO3de=true) const |
Same as above but returns the pose data as an AZ::Transform. The AZ::Transform also includes the controller scale. | |
float | GetControllerScale (AZ::u32 handIndex) const |
Returns scale for a controller attached to a hand index. | |
AZ::RHI::ResultCode | GetVisualizedSpacePose (OpenXRVk::SpaceType visualizedSpaceType, AZ::RPI::PoseData &outPoseData, bool convertToO3de=true) const |
AZ::RHI::ResultCode | GetVisualizedSpaceTransform (OpenXRVk::SpaceType visualizedSpaceType, AZ::Transform &outTransform, bool convertToO3de=true) const |
Same as above but returns the pose data as an AZ::Transform. | |
XrAction | GetSqueezeAction (AZ::u32 handIndex) const |
Get the Squeeze action. | |
XrAction | GetPoseAction (AZ::u32 handIndex) const |
Get the Pose action. | |
XrAction | GetVibrationAction () const |
Get the Vibration action. | |
XrAction | GetQuitAction () const |
Get the Quit action. | |
bool | GetButtonState (const AzFramework::InputChannelId &channelId) const |
Get any button state. | |
bool | GetXButtonState () const |
Get the X button state. | |
bool | GetYButtonState () const |
Get the Y button state. | |
bool | GetAButtonState () const |
Get the A button state. | |
bool | GetBButtonState () const |
Get the B button state. | |
float | GetXJoyStickState (AZ::u32 handIndex) const |
Get the joystick state for x-axis. | |
float | GetYJoyStickState (AZ::u32 handIndex) const |
Get the joystick state for y-axis. | |
float | GetSqueezeState (AZ::u32 handIndex) const |
Get the Squeeze action. | |
float | GetTriggerState (AZ::u32 handIndex) const |
Get the Squeeze action. | |
Static Public Member Functions | |
static XR::Ptr< Input > | Create () |
Static Public Attributes | |
static constexpr char | LogName [] = "OpenXRVkInput" |
AZ::RHI::ResultCode OpenXRVk::Input::GetControllerPose | ( | AZ::u32 | handIndex, |
AZ::RPI::PoseData & | outPoseData, | ||
bool | convertToO3de = true |
||
) | const |
Return Pose data for a controller attached to a hand index By default the pose data is converted per O3DE convention: Xright, Yfront, Zup. You can read the raw XR Pose data by setting @convertToO3de to false (Not recommended, but useful for debugging).
AZ::RHI::ResultCode OpenXRVk::Input::GetVisualizedSpacePose | ( | OpenXRVk::SpaceType | visualizedSpaceType, |
AZ::RPI::PoseData & | outPoseData, | ||
bool | convertToO3de = true |
||
) | const |
Return Pose data for a tracked space type (i.e visualizedSpaceType). By default the pose data is converted per O3DE convention: Xright, Yfront, Zup. You can read the raw XR Pose data by setting @convertToO3de to false (Not recommended, but useful for debugging).
void OpenXRVk::Input::PollActions | ( | ) |
Sync all the actions and update controller. REMARK: XrPoses are not updated in this function. Instead, poses are updated upon UpdateXrSpaceLocations(). Why? Because PollActions() is called on the main thread outside of the BeginFrame()/EndFrame() loop. This means the if Poses are updated during PollActions(), those poses would be using the predicted display time of the previous frame instead of the current frame.
bool OpenXRVk::Input::UpdateXrSpaceLocations | ( | const OpenXRVk::Device & | device, |
XrTime | predictedDisplayTime, | ||
AZStd::vector< XrView > & | xrViews | ||
) |
Called by the session when the predicted display time has been updated (typically the device updates the predicted display time during BeginFrame).
[in] | device | The device that emitted this event. |
[in] | predictedTime | The predicted display time for the current frame. |
[out] | xrViews | Vector where each Eye Pose will be stored. Eye poses are always relative to the VIEW space. The VIEW pose typically represents the pose of the Head (The Head is typically centered between both eyes). Subscript 0 is the left eye, while subscript 1 is the right eye. Returns true if the number of Eye Poses matches the size of @xrViews. |