cancel
Showing results for 
Search instead for 
Did you mean: 

OVR Spatial anchor position lost

meta.escpae
Explorer

We are trying to make a shared space game using shared anchors but 50% of the anchors after some time looses position and start matching face position..... I'm the only one with this problem? there is a solution?

I am now desperate

5 REPLIES 5

meta.escpae
Explorer

no one have this problem?

I think not so many people are using spatial anchors ... same here - i am trying to match a realworld room - and the anchors are always slightly shift position ... this way its just useless

aesiio
Explorer
What is your programming enviornment? Unity? Native? Something else?
I think your issue might be that you need to update the anchor's pose at regular intervals to avoid drift. In my case, I update the pose every frame. It worked for me to stabilize the anchors.
If you're doing Native development, you should update the pose of the anchor by regularly calling xrLocateSpace on the anchor's XrSpace handle to get the updated pose.
If we look at the Mobile OpenXR sample code, we see a line that reads, "Updating it regularly will prevent drift" (SpatialAnchorXr.cpp):
...
for (XrSpace space : scene.SpaceList) {
// If anchor was placed, just update the anchor location
// Updating it regularly will prevent drift
XrSpaceLocation persistedAnchorLoc = {};
persistedAnchorLoc.type = XR_TYPE_SPACE_LOCATION;
XrResult res = XR_SUCCESS;
OXR(res = xrLocateSpace(
space,
app.LocalSpace,
frameState.predictedDisplayTime,
&persistedAnchorLoc));
if (res == XR_SUCCESS) {
OVR::Posef localFromPersistedAnchor = FromXrPosef(persistedAnchorLoc.pose);
persistedCube.Model = OVR::Matrix4f(localFromPersistedAnchor);
persistedCube.Model *= OVR::Matrix4f::Scaling(0.01f, 0.01f, 0.05f);
scene.CubeData.push_back(persistedCube);
} else {
ALOGE("Failed getting anchor pose");
}
}
...
If you're using Unity, I have less experience there... but I am guessing the principle is the same. You should probably be calling OVRPlugin.LocateSpace on the anchor handle at regular intervals. (Maybe every frame? Might be overkill... but should work.)

Hey - Thanks for the comment... i am working in Unreal... will try to find an equivalent function in UE today ... thanks again for the hint - hopes are up again ... 😊

QuantenKlaus
Honored Guest

I made the same experience (driftig anchors, after I was walking through the apartment), when I was testing a build out of the sample scene v40. Save situation with a build from the v46 sample scene.

At the moment I can't really understand how this low reliability can be used for co-located MR experience. I hope it will be much better with v47.