WVR_GetSpatialAnchorState

WVR_EXPORT WVR_Result WVR_GetSpatialAnchorState(WVR_SpatialAnchor anchor, WVR_PoseOriginModel originModel, WVR_SpatialAnchorState * anchorState)

Function is used to retrieve WVR_SpatialAnchorState related to the input anchor.

Version
API Level 11
Parameters
  • anchor: input anchor handle
  • originModel: Only WVR_PoseOriginModel_OriginOnHead and WVR_PoseOriginModel_OriginOnGround are supported, refer to WVR_PoseOriginModel.
  • anchorState: the returned data related to input anchor
Return Value
  • WVR_Success: Get the input spacial anchor state successfully.
  • others: WVR_Result mean failure.

How to use

Sample function:

#include <wvr/wvr_scene.h>
#include <wvr/wvr_anchor.h>

if (WVR_StartScene() == WVR_Success) {
    WVR_Pose_t wvrPose = {1, 2, 3, 1.0, 2.2, 3.3, 4.4};
    WVR_SpatialAnchorCreateInfo info = {wvrPose, WVR_PoseOriginModel_OriginOnGround, "sampleAnchor"};
    WVR_SpatialAnchor anchor;
    if (WVR_CreateSpatialAnchor(&info, &anchor) == WVR_Success) {
        // create anchor success

        WVR_SpatialAnchorState anchorState = {};
        if (WVR_GetSpatialAnchorState(anchor, WVR_PoseOriginModel_OriginOnGround, &anchorState) == WVR_Success) {
            // get the anchor state successfully
        }
    }
    WVR_StopScene();
} else {
    // start scene failed!
}