WVR_DestroySpatialAnchor¶
-
WVR_EXPORT WVR_Result WVR_DestroySpatialAnchor(WVR_SpatialAnchor anchor)
Function is used to destroy a spatial anchor.
Developers use this API to destroy an anchor handle.
Note: Since API Level 14, once the spatial anchor list has been changed, the corresponding event (WVR_EventType) will be fired. This API may cause WVR_EventType_SpatialAnchor_Changed event.
- Version
- API Level 11
- Parameters
anchor
: the spatial anchor that developers would like to destroy
- Return Value
WVR_Success
: Destroy a spatial anchor successfully.others
: WVR_Result mean failure.
How to use¶
Sample function:
#include <wvr/wvr_scene.h>
#include <wvr/wvr_anchor.h>
// the anchor is WVR_SpatialAnchor handle, which is created before
if (WVR_DestroySpatialAnchor(anchor) == WVR_Success) {
// destroy anchor successfully
}
// somewhere to listen spatial anchor list change event
void ProcessEvent() {
WVR_Event_t event;
while(WVR_PollEventQueue(&event)) {
switch (event.common.type) {
case WVR_EventType_SpatialAnchor_Changed: {
uint32_t output = 0;
if (WVR_EnumerateSpatialAnchors(0, &output, nullptr) == WVR_Success) {
auto anchors = (WVR_SpatialAnchor*)malloc(sizeof(WVR_SpatialAnchor)*(output));
if (WVR_EnumerateSpatialAnchors(output, &output, anchors) == WVR_Success) {
// enumerate all spatial anchors successfully
}
}
break;
}
}
}
}