WVR_PersistSpatialAnchor¶
-
WVR_EXPORT WVR_Result WVR_PersistSpatialAnchor(const WVR_SpatialAnchorPersistInfo * spatialAnchorPersistInfo)
Function is used to build and store a persisted anchor from previous created spatial anchor.
Developers use this API to build and store a persisted anchor on runtime. The persisted anchor is saved with feature points info. around the object and environment, so it exists even the SLAM tracking map is reset and re-create.
Note: Once the persisted spatial anchor list has been changed, the corresponding event (WVR_EventType) will be fired. This API will cause WVR_EventType_PersistedAnchor_Changed event.
- Version
- API Level 14
- Parameters
spatialAnchorPersistInfo
: creation information from previous created spatial anchor and give an unique persistedSpatialAnchorName, refer to WVR_SpatialAnchorPersistInfo
- Return Value
WVR_Success
: Build and store a persisted anchor successfully.others
: WVR_Result mean failure.
How to use¶
Sample function:
// the anchor is WVR_SpatialAnchor handle, which is created before
WVR_SpatialAnchorPersistInfo persistInfo = {anchor, "uniquePersistedName"};
if (WVR_CacheSpatialAnchor(&persistInfo) == WVR_Success) {
// persist the anchor successfully
}
// somewhere to listen persisted spatial anchor list change event
void ProcessEvent() {
WVR_Event_t event;
while(WVR_PollEventQueue(&event)) {
switch (event.common.type) {
case WVR_EventType_PersistedAnchor_Changed: {
// .....
break;
}
}
}
}