Reputation: 462
I am implementing the new augmenting images recognition feature of the ArCore
. The recognition of my database images is working fine and a video start playing when they get recognized. However i was wondering if there is any listener that is called when the image is not visible any more in the scene so that i can stop and hide the video of that image. Currently in my implementation the video stays to the same position in the scene where the image was recognized even if i remove the physical image.
Upvotes: 0
Views: 1147
Reputation: 156
Check the current TrackingMethod for the AugmentedImage when the TrackingState is Tracking. When the image is in view of the camera the TrackingMethod is FULL_TRACKING ,else it will be in LAST_KNOWN_POSE. If you are using the sample augmentedImages example, it will be like this in AugmentedImageActvity.java -
private void onUpdateFrame(FrameTime frameTime)
{
.
for (AugmentedImage augmentedImage : updatedAugmentedImages)
{
.
switch (augmentedImage.getTrackingState())
{
.
case TRACKING: if(augmentedImage.getTrackingMethod()==AugmentedImage.TrackingMethod.FULL_TRACKING) {
//Enable VideoNode
}
else{
//Disable VideoNode / Pause MediaPlayer /detach node
}
}
}
}
Upvotes: 2