App-info:
I am developing an Android application based on ArCore (NDK) to augment certain objects (generated from blender tool) over real camera feed. Now that I am able to draw objects as anchors which scales up/down upon camera position changes.
I am using ArSession_acquireNewAnchor API to host an anchor about few inches away from the camera like below.
ArPose_create(ar_session_, nullptr, &camera_pose);
ArPose_getPoseRaw(ar_session_, camera_pose, raw_camera_pose);
ArAnchor *anchor = nullptr;
if (ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)!=AR_SUCCESS) {
LOGE("Anchor is not successfully acquired");
}
After launching the application and holding the device at the same direction, the above anchor is seen.
Problem statement:
When the camera location/direction changes, those anchors are not appearing as expected. Please help - PFB the pictorial representation of the problem.
My Observations:
As I am acquiring the anchor based on camera pose, I assume that direction and pose attributes of anchor will be based on camera pose only i.e. when the camera moves (translation), the anchor too moves accordingly - Is my understanding correct?
ArSession_acquireNewAnchor(ar_session_, raw_camera_pose, &anchor)
Upon using hitResult based anchor acquisition, everything works fine i.e. anchor object appears when the devices changes from one direction to other direction at the appropriate location (touch co-ordinates) - However my use-case does not depend on touch input events. I need to achieve the same effect at the pre-defined location co-ordinates of a given scene.
if(ArHitResult_acquireNewAnchor(ar_session_, ar_hit_result, &anchor)!= AR_SUCCESS) { LOGE("NOT SUCCESSFUL"); return; }
Kindly note that this is being developed using ArCore NDK.