WVR_GetCtrlerModelAnimNodeData

WVR_EXPORT WVR_Result WVR_GetCtrlerModelAnimNodeData(WVR_DeviceType ctrlerType, WVR_CtrlerModelAnimData_t ** ctrlModelAnimData)

Use this function to get the controller animation for the currently connected device.

Note: It is not recommended to call this function after we get controller model.

Version
API Level 7
Parameters
  • ctrlerType: Device type: WVR_DeviceType_Controller_Right or WVR_DeviceType_Controller_Left.(refer to WVR_DeviceType)
  • ctrlModelAnimData: (Output) A double pointer for receiving the controller animation data structure. The SDK will allocate the data structure for the animation data and write it into the structure.
Return Value
  • WVR_SUCCESS: The controller animation data was successfully retrieved from the currently connected device.
  • WVR_Error_CtrlerModel_DeviceDisconnected: The SDK can’t get the controller animation since the controller you want to get is not connected.
  • WVR_Error_CtrlerModel_Unknown: The SDK can’t get the controller animation since the system has not yet been initialized.
  • WVR_Error_InvalidArgument: If ctrlModelAnimData is nullptr or pointer in *ctrlModelAnimData isn’t nullptr.
  • WVR_Error_CtrlerModel_NoAnimationData: The controller animation data isn’t existed.

How to use

See the example below:

std::function<void()> loadModelFunc = [this](){
    if (mCachedData != nullptr) {
        WVR_ReleaseControllerModel(&mCachedData); //we will clear cached data ptr to nullptr.
    }
    WVR_Result result = WVR_GetCurrentControllerModel(mCtrlerType, &mCachedData);
    if (result == WVR_Success) {
        //It represent ok, set a flag to notify graphics initialization in render thread.
        // Get API data.
        WVR_CtrlerModelAnimData_t *animData = nullptr;
        result = WVR_GetCtrlerModelAnimNodeData(mCtrlerType, &animData);
        if (result == WVR_Success) {
            //To Do : to initialize pose data.
            //........
            //Release after inititalization.
            WVR_ReleaseCtrlerModelAnimNodeData(&animData);
        }
    }
};

The full example is in the Controller class of the wvr_native_hellovr sample.